summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ed5f07a)
raw | patch | inline | side by side (parent: ed5f07a)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Sat, 7 Jul 2007 17:50:39 +0000 (18:50 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 7 Jul 2007 18:54:51 +0000 (11:54 -0700) |
"git apply" used to take check the whitespace in the wrong
direction.
Noticed by Daniel Barkalow.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
direction.
Noticed by Daniel Barkalow.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-apply.c | patch | blob | history | |
t/t4116-apply-reverse.sh | patch | blob | history |
diff --git a/builtin-apply.c b/builtin-apply.c
index 0399743c4e2288a0812faeea92c07a5f6a13fccc..490e23ef40c2b2d16272c67a67a14a1eb03b3877 100644 (file)
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1003,12 +1003,16 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
trailing++;
break;
case '-':
+ if (apply_in_reverse &&
+ new_whitespace != nowarn_whitespace)
+ check_whitespace(line, len);
deleted++;
oldlines--;
trailing = 0;
break;
case '+':
- if (new_whitespace != nowarn_whitespace)
+ if (!apply_in_reverse &&
+ new_whitespace != nowarn_whitespace)
check_whitespace(line, len);
added++;
newlines--;
index 2685b2263017df96159542853b373ea261880ba4..11e02807a5324ad263c9b2bce53be3df9daf2117 100755 (executable)
--- a/t/t4116-apply-reverse.sh
+++ b/t/t4116-apply-reverse.sh
)
'
+test_expect_success 'reversing a whitespace introduction' '
+ sed "s/a/a /" < file1 > file1.new &&
+ mv file1.new file1 &&
+ git diff | git apply --reverse --whitespace=error
+'
+
test_done