diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-09-03 14:08:20 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-09-04 11:44:40 -0700 |
commit | efa574438fca4ed328d2e47ecdb6363c50a905ec (patch) | |
tree | 7efe135148b2f53cae47004cc578910b83a3c16f /cache-tree.h | |
parent | apply --whitespace=fix: fix handling of blank lines at the eof (diff) | |
download | tgif-efa574438fca4ed328d2e47ecdb6363c50a905ec.tar.xz |
apply --whitespace=fix: detect new blank lines at eof correctly
The command tries to strip blank lines at the end of the file added by a
patch. It is done by first detecting if a hunk in patch has additional
blank lines at the end of itself, and if so checking if such a hunk
applies at the end of file. This patch addresses a bug in the logic to
implement the former (the previous one addressed a bug in the latter).
If the original ends with blank lines, often the patch hunk ends like
this:
@@ -l,5 +m,7 @@$
_context$
_context$
-deleted$
+$
+$
+$
_$
_$
where _ stands for SP and $ shows a end-of-line. This example patch adds
three trailing blank lines, but the code fails to notice it, because it
only pays attention to added blank lines at the very end of the hunk. In
this example, the three added blank lines do not appear textually at the
end in the patch, even though you can see that they are indeed added at
the end, if you rearrange the diff like this:
@@ -l,5 +m,7 @@$
_context$
_context$
-deleted$
_$
_$
+$
+$
+$
The fix is not to reset the number of (candidate) added blank lines at the
end when the loop sees a context line that is empty.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache-tree.h')
0 files changed, 0 insertions, 0 deletions