Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  Fix "apply --reverse" with regard to whitespace
  • Loading branch information
gitster committed Jul 7, 2007
2 parents 4d3f4b8 + 5fda48d commit 0707a9d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion builtin-apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -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--;
Expand Down
6 changes: 6 additions & 0 deletions t/t4116-apply-reverse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0707a9d

Please sign in to comment.