summaryrefslogtreecommitdiff
path: root/builtin-apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-02-27 01:31:42 -0800
committerJunio C Hamano <junkio@cox.net>2007-02-27 01:33:14 -0800
commit63e50d492c658b4a0d616f57f8b43a7a9ba1bbcc (patch)
tree3cdeab6a531940c77680498bf5687f2b4f22371e /builtin-apply.c
parentee24ee55c28e46b502e4e2d219feced5a5d67e6b (diff)
downloadgit-63e50d492c658b4a0d616f57f8b43a7a9ba1bbcc.tar.gz
git-apply: do not fix whitespaces on context lines.
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>
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index abe3538715..bec95d6c8a 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -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;
}