Git fork

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>

authored by

Thomas Rast and committed by
Junio C Hamano
6cf91492 7dde4bb3

+29 -1
+1 -1
builtin-apply.c
··· 919 919 newlines++; 920 920 continue; 921 921 case '\\': 922 - break; 922 + continue; 923 923 case '@': 924 924 ret = size < 3 || prefixcmp(line, "@@ "); 925 925 break;
+2
t/t4100-apply-stat.sh
··· 33 33 non git (1) 34 34 non git (2) 35 35 non git (3) 36 + incomplete (1) 37 + incomplete (2) 36 38 EOF 37 39 38 40 test_done
+2
t/t4100/t-apply-8.expect
··· 1 + t/t4100-apply-stat.sh | 2 +- 2 + 1 files changed, 1 insertions(+), 1 deletions(-)
+11
t/t4100/t-apply-8.patch
··· 1 + diff --git a/t/t4100-apply-stat.sh b/t/t4100-apply-stat.sh 2 + index be837bb..0798c64 100755 3 + --- a/t/t4100-apply-stat.sh 4 + +++ b/t/t4100-apply-stat.sh 5 + @@ -35,4 +35,4 @@ non git (2) 6 + non git (3) 7 + EOF 8 + 9 + -test_done 10 + +test_done 11 + \ No newline at end of file
+2
t/t4100/t-apply-9.expect
··· 1 + t/t4100-apply-stat.sh | 2 +- 2 + 1 files changed, 1 insertions(+), 1 deletions(-)
+11
t/t4100/t-apply-9.patch
··· 1 + diff --git a/t/t4100-apply-stat.sh b/t/t4100-apply-stat.sh 2 + index 0798c64..be837bb 100755 3 + --- a/t/t4100-apply-stat.sh 4 + +++ b/t/t4100-apply-stat.sh 5 + @@ -35,4 +35,4 @@ non git (2) 6 + non git (3) 7 + EOF 8 + 9 + -test_done 10 + \ No newline at end of file 11 + +test_done