aboutsummaryrefslogtreecommitdiffstats
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-05 13:30:50 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-05 13:37:20 -0800
commit806aa30511bcb487c7bf56a0e716f299c8c467ff (patch)
tree60b98911f558057ee868ca53b08d43eb32c90fbe /diff.c
parentwhitespace: allocate a few more bits and define WS_INCOMPLETE_LINE (diff)
downloadgit-806aa30511bcb487c7bf56a0e716f299c8c467ff.tar.gz
git-806aa30511bcb487c7bf56a0e716f299c8c467ff.zip
apply: check and fix incomplete lines
The final line of a file that lacks the terminating newline at its end is called an incomplete line. In general they are frowned upon for many reasons (imagine concatenating two files with "cat A B" and what happens when A ends in an incomplete line, for example), and text-oriented tools often mishandle such a line. Implement checks in "git apply" for incomplete lines, which is off by default for backward compatibility's sake, so that "git apply --whitespace={fix,warn,error}" can notice, warn against, and fix them. As one of the new test shows, if you modify contents on an incomplete line in the original and leave the resulting line incomplete, it is still considered a whitespace error, the reasoning being that "you'd better fix it while at it if you are making a change on an incomplete line anyway", which may controversial. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
0 files changed, 0 insertions, 0 deletions