Skip to content

Commit 3e1eb2b

Browse files
jeffhostetlerdscho
authored andcommitted
status: disable deserialize when verbose output requested.
Disable deserialization when verbose output requested. Verbose mode causes Git to print diffs for modified files. This requires the index to be loaded to have the currently staged OID values. Without loading the index, verbose output make it look like everything was deleted. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent 5398a74 commit 3e1eb2b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

builtin/commit.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "commit-graph.h"
4343
#include "pretty.h"
4444
#include "trailer.h"
45+
#include "trace2.h"
4546

4647
static const char * const builtin_commit_usage[] = {
4748
N_("git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
@@ -1737,6 +1738,22 @@ struct repository *repo UNUSED)
17371738
*/
17381739
try_deserialize = (!do_serialize &&
17391740
(do_implicit_deserialize || do_explicit_deserialize));
1741+
1742+
/*
1743+
* Disable deserialize when verbose is set because it causes us to
1744+
* print diffs for each modified file, but that requires us to have
1745+
* the index loaded and we don't want to do that (at least not now for
1746+
* this seldom used feature). My fear is that would further tangle
1747+
* the merge conflict with upstream.
1748+
*
1749+
* TODO Reconsider this in the future.
1750+
*/
1751+
if (try_deserialize && verbose) {
1752+
trace2_data_string("status", the_repository, "deserialize/reject",
1753+
"args/verbose");
1754+
try_deserialize = 0;
1755+
}
1756+
17401757
if (try_deserialize)
17411758
goto skip_init;
17421759

0 commit comments

Comments
 (0)