Skip to content

Commit 9950ec7

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 <jeffhost@microsoft.com>
1 parent 564ca16 commit 9950ec7

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
@@ -46,6 +46,7 @@
4646
#include "commit-reach.h"
4747
#include "commit-graph.h"
4848
#include "pretty.h"
49+
#include "trace2.h"
4950

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

0 commit comments

Comments
 (0)