]> git.ipfire.org Git - thirdparty/git.git/commit
diff: highlight and error out on incomplete lines
authorJunio C Hamano <gitster@pobox.com>
Wed, 12 Nov 2025 22:02:57 +0000 (14:02 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Nov 2025 22:04:05 +0000 (14:04 -0800)
commitab2693cb52a40f597d3cc2b6938626d14655f7c0
tree8e81b77cd000d22a62960d444b1a37db2fd985a9
parent9fb15a8e1430b77e2cc771e425ce4f0954ce4777
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