Skip to content

Commit e57caee

Browse files
committed
Merge branch 'pg/diff-stat-unmerged-regression-fix'
The output from "git diff --stat" on an unmerged path lost the terminating LF in Git 2.39, which has been corrected. * pg/diff-stat-unmerged-regression-fix: diff: fix regression with --stat and unmerged file
2 parents 78d1502 + 209d9cb commit e57caee

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2800,7 +2800,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
28002800
else if (file->is_unmerged) {
28012801
strbuf_addf(&out, " %s%s%*s | %*s",
28022802
prefix, name, padding, "",
2803-
number_width, "Unmerged");
2803+
number_width, "Unmerged\n");
28042804
emit_diff_symbol(options, DIFF_SYMBOL_STATS_LINE,
28052805
out.buf, out.len, 0);
28062806
strbuf_reset(&out);

t/t4046-diff-unmerged.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,14 @@ test_expect_success 'diff-files -3' '
8686
test_cmp diff-files-3.expect diff-files-3.actual
8787
'
8888

89+
test_expect_success 'diff --stat' '
90+
for path in $paths
91+
do
92+
echo " $path | Unmerged" || return 1
93+
done >diff-stat.expect &&
94+
echo " 0 files changed" >>diff-stat.expect &&
95+
git diff --cached --stat >diff-stat.actual &&
96+
test_cmp diff-stat.expect diff-stat.actual
97+
'
98+
8999
test_done

0 commit comments

Comments
 (0)