Skip to content

Commit c46d883

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 3789b0b commit c46d883

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
@@ -38,6 +38,7 @@
3838
#include "commit-graph.h"
3939
#include "pretty.h"
4040
#include "trailer.h"
41+
#include "trace2.h"
4142

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

0 commit comments

Comments
 (0)