summaryrefslogtreecommitdiff
path: root/builtin/apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-01-16 21:21:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-01-22 20:57:24 (GMT)
commit0a80bc9f13bf4373778e787b3a050f5b784faf30 (patch)
treede8383662567b2502a3b4bac5e9462f374626544 /builtin/apply.c
parent407a792ef7e3c142a47c6b09a80f9ede4e14f444 (diff)
downloadgit-0a80bc9f13bf4373778e787b3a050f5b784faf30.zip
git-0a80bc9f13bf4373778e787b3a050f5b784faf30.tar.gz
git-0a80bc9f13bf4373778e787b3a050f5b784faf30.tar.bz2
apply: detect and mark whitespace errors in context lines when fixing
When the incoming patch has whitespace errors in a common context line (i.e. a line that is expected to be found and is not modified by the patch), "apply --whitespace=fix" corrects the whitespace errors the line has, in addition to the whitespace error on a line that is updated by the patch. However, we did not count and report that we fixed whitespace errors on such lines. [jc: This is iffy. What if the whitespace error has been fixed in the target since the patch was written? A common context line we see in the patch has errors, and it matches a line in the target that has the errors already corrected, resulting in no change, which we may not want to count after all. On the other hand, we are reporting whitespace errors _in_ the incoming patch, so...] Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/apply.c')
-rw-r--r--builtin/apply.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index e895340..a51a1b0 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1606,6 +1606,9 @@ static int parse_fragment(const char *line, unsigned long size,
if (!deleted && !added)
leading++;
trailing++;
+ if (!apply_in_reverse &&
+ ws_error_action == correct_ws_error)
+ check_whitespace(line, len, patch->ws_rule);
break;
case '-':
if (apply_in_reverse &&