Skip to content

Commit

Permalink
git-apply: do not fix whitespaces on context lines.
Browse files Browse the repository at this point in the history
Internal function apply_line() is called to copy both context lines
and added lines to the output buffer, while possibly fixing the
whitespace breakages depending on --whitespace=strip settings.
However, it did its fix-up on both context lines and added lines.

This resulted in two symptoms:

 (1) The number of lines reported to have been fixed up included
     these context lines.

 (2) However, the lines actually shown were limited to the added
     lines that had whitespace breakages.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Feb 27, 2007
1 parent ee24ee5 commit 63e50d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin-apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,8 @@ static int apply_line(char *output, const char *patch, int plen)
int need_fix_leading_space = 0;
char *buf;

if ((new_whitespace != strip_whitespace) || !whitespace_error) {
if ((new_whitespace != strip_whitespace) || !whitespace_error ||
*patch != '+') {
memcpy(output, patch + 1, plen);
return plen;
}
Expand Down

0 comments on commit 63e50d4

Please sign in to comment.