[Buildbot-commits] [Buildbot] #2758: 'buildbot try' fails with "error: hello.c: does not match index"

Buildbot trac trac at buildbot.net
Tue Apr 15 23:01:44 UTC 2014


#2758: 'buildbot try' fails with "error: hello.c: does not match index"
----------------------+-----------------------
Reporter:  dank       |      Owner:
    Type:  undecided  |     Status:  new
Priority:  major      |  Milestone:  undecided
 Version:  0.8.8      |   Keywords:
----------------------+-----------------------
 (I think I ran into this in a past life, so this isn't new.
 It might only affect fresh repos.)

 With buildbot from master, and git 1.7.9.5, trying to do
 {{{
   buildbot try -c pb --username=xxx --passwd=xxx -m buildmaster:8031
 --vc=git --wait
 }}}
 submits the job nicely, but it always fails with
 {{{
 error: hello.c: does not match index
 }}}
 This can be reproduced locally with
 {{{
    git diff > my.patch
    patch -R -p1 < my.patch
    git apply --check -p 1 < my.patch    # succeeds
    git apply --index -p 1 < my.patch    # fails
 }}}
 This appears to be a problem-ish in git, see
 http://git.661346.n2.nabble.com/quot-git-apply-check-quot-successes-but-
 git-am-says-quot-does-not-match-index-quot-td6684646.html
 It affected git-am, and they fixed it by adding the line
 {{{
   git update-index -q --refresh
 }}}
 before patching.  Sure enough, applying this patch
 {{{
 --- a/master/buildbot/steps/source/git.py
 +++ b/master/buildbot/steps/source/git.py
 @@ -561,8 +561,10 @@ class Git(Source):
          return d

      def applyPatch(self, patch):
 -        d = self._dovccmd(['apply', '--index', '-p', str(patch[0])],
 -                          initialStdin=patch[1])
 +        d = self._dovccmd(['update-index', '--refresh'])
 +        def applyAlready(res):
 +            return self._dovccmd(['apply', '--index', '-p',
 str(patch[0])], initialStdin=patch[1])
 +        d.addCallback(applyAlready)
          return d

      def _sourcedirIsUpdatable(self):
 }}}
 seems to solve the problem.  The patch is also available at

 https://github.com/dankegel/buildbot-x/tree/update-index-before-git-try-
 patch

-- 
Ticket URL: <http://trac.buildbot.net/ticket/2758>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list