From 209d9cb0114dff72e96d58bb3c27409660f1b45c Mon Sep 17 00:00:00 2001 From: Peter Grayson Date: Wed, 14 Dec 2022 12:41:51 -0500 Subject: 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 Acked-by: Jeff King Signed-off-by: Junio C Hamano --- diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'diff.c') diff --git a/diff.c b/diff.c index 2751cae131..7e88d7e27a 100644 --- a/diff.c +++ b/diff.c @@ -2784,7 +2784,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options) else if (file->is_unmerged) { strbuf_addf(&out, " %s%s%*s | %*s", prefix, name, padding, "", - number_width, "Unmerged"); + number_width, "Unmerged\n"); emit_diff_symbol(options, DIFF_SYMBOL_STATS_LINE, out.buf, out.len, 0); strbuf_reset(&out); -- cgit v1.2.3