diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-08-30 13:20:31 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-30 13:23:02 -0700 |
commit | ed0f47a8c431f27e0bd131ea1cf9cabbd580745b (patch) | |
tree | 2ede2745b8611c76ac76b7b9e240a1e092b87f84 /wt-status.c | |
parent | ee837244df2e2e4e9171f508f83f353730db9e53 (diff) | |
download | git-ed0f47a8c431f27e0bd131ea1cf9cabbd580745b.tar.gz git-ed0f47a8c431f27e0bd131ea1cf9cabbd580745b.tar.xz |
git-apply: Loosen "match_beginning" logic
Even after a handfle attempts, match_beginning logic still has corner
cases:
1bf1a85 (apply: treat EOF as proper context., 2006-05-23)
65aadb9 (apply: force matching at the beginning., 2006-05-24)
4be6096 (apply --unidiff-zero: loosen sanity checks ..., 2006-09-17)
ee5a317 (Fix "git apply" to correctly enforce "match ..., 2008-04-06)
This is a tricky piece of code.
We still incorrectly enforce "match_beginning" for -U0 matches.
I noticed this while trying out an example sequence from Clemens Buchacher:
$ echo a >victim
$ git add victim
$ echo b >>victim
$ git diff -U0 >patch
$ cat patch
diff --git i/victim w/victim
index 7898192..422c2b7 100644
--- i/victim
+++ w/victim
@@ -1,0 +2 @@ a
+b
$ git apply --cached --unidiff-zero <patch
$ git show :victim
b
a
The change inserts a new line before the second line, but we insist it to
be applied at the beginning. As the result, the code refuses to apply it
at the original offset, and we end up adding the line at the beginning.
Updates to the test script are by Clemens Buchacher.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
0 files changed, 0 insertions, 0 deletions