Skip to content

Commit 02652b2

Browse files
jeffhostetlervdye
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 <jeffhost@microsoft.com>
1 parent 698f1b2 commit 02652b2

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
@@ -43,6 +43,7 @@
4343
#include "commit-reach.h"
4444
#include "commit-graph.h"
4545
#include "pretty.h"
46+
#include "trace2.h"
4647

4748
static const char * const builtin_commit_usage[] = {
4849
N_("git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
@@ -1716,6 +1717,22 @@ int cmd_status(int argc, const char **argv, const char *prefix)
17161717
*/
17171718
try_deserialize = (!do_serialize &&
17181719
(do_implicit_deserialize || do_explicit_deserialize));
1720+
1721+
/*
1722+
* Disable deserialize when verbose is set because it causes us to
1723+
* print diffs for each modified file, but that requires us to have
1724+
* the index loaded and we don't want to do that (at least not now for
1725+
* this seldom used feature). My fear is that would further tangle
1726+
* the merge conflict with upstream.
1727+
*
1728+
* TODO Reconsider this in the future.
1729+
*/
1730+
if (try_deserialize && verbose) {
1731+
trace2_data_string("status", the_repository, "deserialize/reject",
1732+
"args/verbose");
1733+
try_deserialize = 0;
1734+
}
1735+
17191736
if (try_deserialize)
17201737
goto skip_init;
17211738

0 commit comments

Comments
 (0)