bug in git-apply

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



StGit's test suite has started failing, and it's due to a change in
git that I'm pretty sure is a bug. I built a small test case using
just git for easier testing:

  mkdir foo
  cd foo

  git init
  touch xx
  git add xx
  git commit -m 'first'

  git checkout -b branch

  echo aaa >> xx
  git add xx
  git commit -m 'second'

  git checkout master

  echo bbb >> xx
  git add xx
  git commit -m 'third'

  git diff branch^ branch > p
  git apply < p && echo "this should not succeed!"

Basically, we have a file containing "aaa\n", and a patch that tries
to take the file from "" to "bbb\n". A recent enough git-apply will
accept this patch without complaining, and put "aaa\nbbb\n" in the
file.

I bisected, and the culprit was this commit:

commit dc41976a3eed1d9c93fdc08c448bab969db4e0ec
Author: Junio C Hamano <gitster@xxxxxxxxx>
Date:   Sat Jan 19 01:58:34 2008 -0800

    builtin-apply.c: push match-beginning/end logic down

    This moves the logic to force match at the beginning and/or at
    the end of the buffer to the actual function that finds the
    match from its caller.  This is a necessary preparation for the
    next step to allow matching disregarding certain differences,
    such as whitespace changes.

    We probably could optimize this even more by taking advantage of
    the fact that match_beginning and match_end forces the match to
    be at an exact location (anchored at the beginning and/or the
    end), but that's for another commit.

    Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>

-- 
Karl Hasselström, kha@xxxxxxxxxxx
      www.treskal.com/kalle
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux