Skip to content

Commit 3fa509d

Browse files
committed
git commit --dry-run -v: show diff in color when asked
The earlier implementation of --dry-run didn't duplicate the use of color "git status -v" set up for diff output. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 60c2993 commit 3fa509d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

builtin-commit.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,9 +979,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
979979

980980
argc = parse_and_validate_options(argc, argv, builtin_commit_usage,
981981
prefix, &s);
982-
if (dry_run)
982+
if (dry_run) {
983+
if (diff_use_color_default == -1)
984+
diff_use_color_default = git_use_color_default;
983985
return dry_run_commit(argc, argv, prefix, &s);
984-
986+
}
985987
index_file = prepare_index(argc, argv, prefix, 0);
986988

987989
/* Set up everything for writing the commit object. This includes

0 commit comments

Comments
 (0)