]> Kevux Git Server - rit/commit
whitespace: symbolic links usually lack LF at the end
authorJunio C Hamano <gitster@pobox.com>
Wed, 4 Feb 2026 21:23:06 +0000 (13:23 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Feb 2026 04:36:48 +0000 (20:36 -0800)
commit6a41481c6de1cedb059930a710896c5ab2508a12
tree96096a5a495420b2c24a1d785cd86554eb755cfa
parent51358a1ede7f4b6b50e4e5a86558af5204691fe0
whitespace: symbolic links usually lack LF at the end

For a patch that touches a symbolic link, it is perfectly normal
that the contents ends with "\ No newline at end of file".  The
checks introduced recently to detect incomplete lines (i.e., a text
file that lack the newline on its final line) should not trigger.

Disable the check early for symbolic links, both in "git apply" and
"git diff" and test them.  For "git apply", we check only when the
postimage is a symbolic link regardless of the preimage, and we only
care about preimage when applying in reverse.  Similarly, "git diff"
would warn only when the postimage is a symbolic link, or the
preimage when running "git diff -R".

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