summaryrefslogtreecommitdiff
path: root/builtin/apply.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-06-24 12:21:39 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-06-24 12:21:39 -0700
commit59c465d5c01a16b29975aee59097efc349de6ab7 (patch)
tree211427c2451aa1fa6456f2d194feed1c1378aebe /builtin/apply.c
parentgit-multimail: update to release 1.1.0 (diff)
parentapply: reject a hunk that does not do anything (diff)
downloadtgif-59c465d5c01a16b29975aee59097efc349de6ab7.tar.xz
Merge branch 'jc/apply-reject-noop-hunk'
"git apply" cannot diagnose a patch corruption when the breakage is to mark the length of the hunk shorter than it really is on the hunk header line "@@ -l,k +m,n @@"; one special case it could is when the hunk becomes no-op (e.g. k == n == 2 for two-line context patch output), and it learned how to do so. * jc/apply-reject-noop-hunk: apply: reject a hunk that does not do anything
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 146be97a1a..54aba4e351 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1638,6 +1638,9 @@ static int parse_fragment(const char *line, unsigned long size,
}
if (oldlines || newlines)
return -1;
+ if (!deleted && !added)
+ return -1;
+
fragment->leading = leading;
fragment->trailing = trailing;