Skip to content

Commit 1c0712d

Browse files
committed
Merge branch 'jk/maint-quiet-is-synonym-to-s-in-log'
We tried to bend backwards to allow "--quiet" to be a synonym as "-s" when given as e.g. "git show --quiet", but did not quite succeed. * jk/maint-quiet-is-synonym-to-s-in-log: log: fix --quiet synonym for -s
2 parents 7ff38b0 + f9c75d8 commit 1c0712d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

builtin/log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
109109
PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN |
110110
PARSE_OPT_KEEP_DASHDASH);
111111

112-
argc = setup_revisions(argc, argv, rev, opt);
113112
if (quiet)
114113
rev->diffopt.output_format |= DIFF_FORMAT_NO_OUTPUT;
114+
argc = setup_revisions(argc, argv, rev, opt);
115115

116116
/* Any arguments at this point are not recognized */
117117
if (argc > 1)

t/t7007-show.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,16 @@ test_expect_success 'showing range' '
108108
test_cmp expect actual.filtered
109109
'
110110

111+
test_expect_success '-s suppresses diff' '
112+
echo main3 >expect &&
113+
git show -s --format=%s main3 >actual &&
114+
test_cmp expect actual
115+
'
116+
117+
test_expect_success '--quiet suppresses diff' '
118+
echo main3 >expect &&
119+
git show --quiet --format=%s main3 >actual &&
120+
test_cmp expect actual
121+
'
122+
111123
test_done

0 commit comments

Comments
 (0)