diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-08-30 20:31:39 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-30 20:31:39 -0700 |
commit | 7df437e56b5a2c5ec7140dd097b517563db4972c (patch) | |
tree | a006f20b481d811ccb4846534ef6394be5bc78a8 /builtin-apply.c | |
parent | ff1e8bfcd69e5e0ee1a3167e80ef75b611f72123 (diff) | |
parent | bbb896d8e10f736bfda8f587c0009c358c9a8599 (diff) | |
download | git-7df437e56b5a2c5ec7140dd097b517563db4972c.tar.gz |
Merge branch 'maint'
* maint:
gitattributes: -crlf is not binary
git-apply: Loosen "match_beginning" logic
Fix example in git-name-rev documentation
shell: do not play duplicated definition games to shrink the executable
Fix use of hardlinks in "make install"
pack-objects: Allow missing base objects when creating thin packs
Diffstat (limited to 'builtin-apply.c')
-rw-r--r-- | builtin-apply.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin-apply.c b/builtin-apply.c index 2216a0bf7c..47261e10fb 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -1996,6 +1996,8 @@ static int apply_one_fragment(struct image *img, struct fragment *frag, /* * A hunk to change lines at the beginning would begin with * @@ -1,L +N,M @@ + * but we need to be careful. -U0 that inserts before the second + * line also has this pattern. * * And a hunk to add to an empty file would begin with * @@ -0,0 +N,M @@ @@ -2003,7 +2005,8 @@ static int apply_one_fragment(struct image *img, struct fragment *frag, * In other words, a hunk that is (frag->oldpos <= 1) with or * without leading context must match at the beginning. */ - match_beginning = frag->oldpos <= 1; + match_beginning = (!frag->oldpos || + (frag->oldpos == 1 && !unidiff_zero)); /* * A hunk without trailing lines must match at the end. |