diff: fix regression with --stat and unmerged file

A regression was introduced in

  12fc4ad89e (diff.c: use utf8_strwidth() to count display width, 2022-09-14)

that causes missing newlines after "Unmerged" entries in `git diff
--cached --stat` output.

This problem affects v2.39.0-rc0 through v2.39.0.

Add the missing newline along with a new test to cover this
behavior.

Signed-off-by: Peter Grayson <pete@jpgrayson.net>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Peter Grayson
2022-12-14 12:41:51 -05:00
committed by Junio C Hamano
parent 12fc4ad89e
commit 209d9cb011
2 changed files with 11 additions and 1 deletions

View File

@ -86,4 +86,14 @@ test_expect_success 'diff-files -3' '
test_cmp diff-files-3.expect diff-files-3.actual
'
test_expect_success 'diff --stat' '
for path in $paths
do
echo " $path | Unmerged" || return 1
done >diff-stat.expect &&
echo " 0 files changed" >>diff-stat.expect &&
git diff --cached --stat >diff-stat.actual &&
test_cmp diff-stat.expect diff-stat.actual
'
test_done