]> git.ipfire.org Git - thirdparty/git.git/commit
diff: highlight and error out on incomplete lines
authorJunio C Hamano <gitster@pobox.com>
Wed, 5 Nov 2025 21:30:51 +0000 (13:30 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Nov 2025 21:37:20 +0000 (13:37 -0800)
commit0cfb6ab295e67a619b51e306c728ce43eb275f9f
treebc83344212e62e5dd2600d2ee7740f409d190906
parent806aa30511bcb487c7bf56a0e716f299c8c467ff
diff: highlight and error out on incomplete lines

Teach "git diff" to highlight "\ No newline at end of file" message
as a whitespace error when incomplete-line whitespace error class is
in effect.  Thanks to the previous refactoring of complete rewrite
code path, we can do this at a single place.

Unlike whitespace errors in the payload where we need to annotate in
line, possibly using colors, the line that has whitespace problems,
we have a dedicated line already that can serve as the error
message, so paint it as a whitespace error message.

Also teach "git diff --check" to notice incomplete lines as
whitespace errors and report when incomplete-line whitespace error
class is in effect.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
t/t4015-diff-whitespace.sh