* [PATCH] Fix apply --recount handling of no-EOL line
@ 2008-07-04 19:10 Thomas Rast
2008-07-04 19:34 ` Johannes Schindelin
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Rast @ 2008-07-04 19:10 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Johannes Schindelin
If a patch modifies the last line of a file that previously had no
terminating '\n', it looks like
-old text
\ No newline at end of file
+new text
Hence, a '\' line does not signal the end of the hunk. This modifies
'git apply --recount' to take this into account.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
This is just the straightforward fix. A more elaborate solution might
check if the previous line was a ' ' and '+', and if so, consider the
hunk terminated anyway.
- Thomas
builtin-apply.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-apply.c b/builtin-apply.c
index 194f03b..fb85a5b 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -931,7 +931,7 @@ static void recount_diff(char *line, int size, struct fragment *fragment)
newlines++;
continue;
case '\\':
- break;
+ continue;
case '@':
ret = size < 3 || prefixcmp(line, "@@ ");
break;
--
1.5.6.1.330.g2ff03
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-04 19:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-04 19:10 [PATCH] Fix apply --recount handling of no-EOL line Thomas Rast
2008-07-04 19:34 ` Johannes Schindelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox