From: Thomas Rast Date: Fri, 04 Jul 2008 19:10:14 GMT Subject: [PATCH] Fix apply --recount handling of no-EOL line Message-ID: <1215198614-22148-1-git-send-email-trast@student.ethz.ch> 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 --- 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