summaryrefslogtreecommitdiff
path: root/builtin/apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-06-24 12:21:39 -0700
committerJunio C Hamano <gitster@pobox.com>2015-06-24 12:21:39 -0700
commit59c465d5c01a16b29975aee59097efc349de6ab7 (patch)
tree211427c2451aa1fa6456f2d194feed1c1378aebe /builtin/apply.c
parent5b1d901c0173b41010856e30776c92d02987ea25 (diff)
parentad6e8ed37bc139c64b1b75a7a9ff6e4054f71756 (diff)
downloadgit-59c465d5c01a16b29975aee59097efc349de6ab7.tar.gz
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;