diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-06-24 12:21:39 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-06-24 12:21:39 -0700 |
commit | 59c465d5c01a16b29975aee59097efc349de6ab7 (patch) | |
tree | 211427c2451aa1fa6456f2d194feed1c1378aebe /builtin/apply.c | |
parent | git-multimail: update to release 1.1.0 (diff) | |
parent | apply: reject a hunk that does not do anything (diff) | |
download | tgif-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.c | 3 |
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; |