Fix apply --recount handling of no-EOL line

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>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Thomas Rast
2008-07-04 21:10:14 +02:00
committed by Junio C Hamano
parent 7dde4bb367
commit 6cf91492d9
6 changed files with 29 additions and 1 deletions

View File

@ -919,7 +919,7 @@ static void recount_diff(char *line, int size, struct fragment *fragment)
newlines++;
continue;
case '\\':
break;
continue;
case '@':
ret = size < 3 || prefixcmp(line, "@@ ");
break;