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:
parent
7dde4bb367
commit
6cf91492d9
@ -919,7 +919,7 @@ static void recount_diff(char *line, int size, struct fragment *fragment)
|
|||||||
newlines++;
|
newlines++;
|
||||||
continue;
|
continue;
|
||||||
case '\\':
|
case '\\':
|
||||||
break;
|
continue;
|
||||||
case '@':
|
case '@':
|
||||||
ret = size < 3 || prefixcmp(line, "@@ ");
|
ret = size < 3 || prefixcmp(line, "@@ ");
|
||||||
break;
|
break;
|
||||||
|
@ -33,6 +33,8 @@ mode
|
|||||||
non git (1)
|
non git (1)
|
||||||
non git (2)
|
non git (2)
|
||||||
non git (3)
|
non git (3)
|
||||||
|
incomplete (1)
|
||||||
|
incomplete (2)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
2
t/t4100/t-apply-8.expect
Normal file
2
t/t4100/t-apply-8.expect
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
t/t4100-apply-stat.sh | 2 +-
|
||||||
|
1 files changed, 1 insertions(+), 1 deletions(-)
|
11
t/t4100/t-apply-8.patch
Normal file
11
t/t4100/t-apply-8.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
diff --git a/t/t4100-apply-stat.sh b/t/t4100-apply-stat.sh
|
||||||
|
index be837bb..0798c64 100755
|
||||||
|
--- a/t/t4100-apply-stat.sh
|
||||||
|
+++ b/t/t4100-apply-stat.sh
|
||||||
|
@@ -35,4 +35,4 @@ non git (2)
|
||||||
|
non git (3)
|
||||||
|
EOF
|
||||||
|
|
||||||
|
-test_done
|
||||||
|
+test_done
|
||||||
|
\ No newline at end of file
|
2
t/t4100/t-apply-9.expect
Normal file
2
t/t4100/t-apply-9.expect
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
t/t4100-apply-stat.sh | 2 +-
|
||||||
|
1 files changed, 1 insertions(+), 1 deletions(-)
|
11
t/t4100/t-apply-9.patch
Normal file
11
t/t4100/t-apply-9.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
diff --git a/t/t4100-apply-stat.sh b/t/t4100-apply-stat.sh
|
||||||
|
index 0798c64..be837bb 100755
|
||||||
|
--- a/t/t4100-apply-stat.sh
|
||||||
|
+++ b/t/t4100-apply-stat.sh
|
||||||
|
@@ -35,4 +35,4 @@ non git (2)
|
||||||
|
non git (3)
|
||||||
|
EOF
|
||||||
|
|
||||||
|
-test_done
|
||||||
|
\ No newline at end of file
|
||||||
|
+test_done
|
Loading…
Reference in New Issue
Block a user