Skip to content

Commit b0393b5

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 3c9a9fe commit b0393b5

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎builtin/commit.c‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "commit-graph.h"
4444
#include "pretty.h"
4545
#include "trailer.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"
@@ -1777,6 +1778,22 @@ struct repository *repo UNUSED)
17771778
*/
17781779
try_deserialize = (!do_serialize &&
17791780
(do_implicit_deserialize || do_explicit_deserialize));
1781+
1782+
/*
1783+
* Disable deserialize when verbose is set because it causes us to
1784+
* print diffs for each modified file, but that requires us to have
1785+
* the index loaded and we don't want to do that (at least not now for
1786+
* this seldom used feature). My fear is that would further tangle
1787+
* the merge conflict with upstream.
1788+
*
1789+
* TODO Reconsider this in the future.
1790+
*/
1791+
if (try_deserialize && verbose) {
1792+
trace2_data_string("status", the_repository, "deserialize/reject",
1793+
"args/verbose");
1794+
try_deserialize = 0;
1795+
}
1796+
17801797
if (try_deserialize)
17811798
goto skip_init;
17821799

0 commit comments

Comments
 (0)