commit, sequencer: turn off break_opt for commit summary
dc6b1d92ca (wt-status: use settings from git_diff_ui_config, 2018-05-04) disabled diffopt.break_opt for diffstats shown by git status and in commit templates. For git status there isn't even a way to enable it. Make the commit summary (shown after the commit) consistent by disabling it there as well. Reported-by: Laurent Lyaudet <laurent.lyaudet@gmail.com> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Apr 4, 2022 at 23:08 UTC
84792322ed9e79c3152d9443ab6609710db4b26a
2 files changed
+31
-1
sequencer.c
-1
@@ -1328,7 +1328,6 @@ void print_commit_summary(struct repository *r,
1328
get_commit_format(format.buf, &rev);
1329
rev.always_show_header = 0;
1330
rev.diffopt.detect_rename = DIFF_DETECT_RENAME;
1331
- rev.diffopt.break_opt = 0;
1331
diff_setup_done(&rev.diffopt);
1332
1333
refs = get_main_ref_store(the_repository);
t/t7524-commit-summary.sh
new
+31
@@ -0,0 +1,31 @@
1
+#!/bin/sh
2
+
3
+test_description='git commit summary'
4
+. ./test-lib.sh
5
+
6
+test_expect_success 'setup' '
7
+ test_seq 101 200 >file &&
8
+ git add file &&
9
+ git commit -m initial &&
10
+ git tag initial
11
+'
12
+
13
+test_expect_success 'commit summary ignores rewrites' '
14
+ git reset --hard initial &&
15
+ test_seq 200 300 >file &&
16
+
17
+ git diff --stat >diffstat &&
18
+ git diff --stat --break-rewrites >diffstatrewrite &&
19
+
20
+ # make sure this scenario is a detectable rewrite
21
+ ! test_cmp_bin diffstat diffstatrewrite &&
22
+
23
+ git add file &&
24
+ git commit -m second >actual &&
25
+
26
+ grep "1 file" <actual >actual.total &&
27
+ grep "1 file" <diffstat >diffstat.total &&
28
+ test_cmp diffstat.total actual.total
29
+'
30
+
31
+test_done