Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] apply: Allow blank *trailing* context lines to match beyond EOF

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:34

Björn Gustavsson [off-list ref] writes:
This patch should fix the problem observed by Junio, but note that
there will be one or more blank lines left at the end of the
file.

I am not sure whether that should be fixed. In this particular
case, the blank lines are part of the context but not part of
the file being patched, so it could be argued that the blank
lines should not be added back.

But there are already other circumstances in which
"--whitespace=fix" does not guarantee that the file does
not end with blank lines, for instance if we have:

 a
 b
 (blank line)
 (blank line)
 (blank line)
 (blank line)
 c
 d

and then delete the "c" and "d" lines:

 a
 b
 (blank line)
 (blank line)
 (blank line)
 (blank line)
Even though I think these are both worth fixing, I do not think it should
happen as part of this patch.  Because the code that needs to "fix" the
"extra blank bug" this patch introduces will need to deal with exactly the
same horizon effect as your "deleting c and d at the end will not have the
blank immediately after b in the context" example, I expect we will fix
the fallout from this patch when we fix that "delete c and d at the end"
example.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help