diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-07-07 12:29:09 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-07-07 12:29:09 -0700 |
commit | 0707a9d6f200bbafc02d13dd7f2c12bb795999f6 (patch) | |
tree | 579501f90e8b0a2d46480df695a01f5d5e90aacf | |
parent | diff-lib.c: don't strdup twice (diff) | |
parent | Fix "apply --reverse" with regard to whitespace (diff) | |
download | tgif-0707a9d6f200bbafc02d13dd7f2c12bb795999f6.tar.xz |
Merge branch 'maint'
* maint:
Fix "apply --reverse" with regard to whitespace
-rw-r--r-- | builtin-apply.c | 6 | ||||
-rwxr-xr-x | t/t4116-apply-reverse.sh | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/builtin-apply.c b/builtin-apply.c index c6f736c14e..0a0b4a9e3f 100644 --- 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--; diff --git a/t/t4116-apply-reverse.sh b/t/t4116-apply-reverse.sh index a7f5905f1e..9ae2b3a8ef 100755 --- a/t/t4116-apply-reverse.sh +++ b/t/t4116-apply-reverse.sh @@ -82,4 +82,10 @@ test_expect_success 'apply in reverse without postimage' ' ) ' +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 |