Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#2127 closed defect (fixed)

Git 1.7.7: Recent change causes buildbot to always fail to fetch from git

Reported by: cdavis5x Owned by:
Priority: critical Milestone: undecided
Version: master Keywords: git


When buildbot updates a repository using Git, one of the things it does is:

$ git branch -M <branch-name>

where <branch-name> is the target branch. Even if the branch already existed, this worked fine...

...up until Git 1.7.7, which for some reason changed this. Now when you try to rename the current branch, git branch -M throws this error:

fatal: Cannot force update the current branch.

Unless this bug is fixed, IT WILL NOT BE POSSIBLE TO USE BUILDBOT WITH GIT >= 1.7.7. Luckily for you all, I went ahead and fixed this for you. (Watch for an upcoming pull request.)

Attachments (1)

buildbot_ticket_2127.patch (2.0 KB) - added by mattock 8 years ago.
Backported fix to buildbot 0.8.5

Download all attachments as: .zip

Change History (5)

comment:1 Changed 8 years ago by dustin

  • Resolution set to fixed
  • Status changed from new to closed

Fix is merged - thanks for spotting that!

comment:2 Changed 8 years ago by mattock

I backported this patch to buildbot 0.7.12 manually, but unfortunately it did not fix the problem. What did seem to fix this was skipping the git branch -M master step conditionally:

    def _didFetch(self, res):
        if self.revision:
            head = self.revision
            head = 'FETCH_HEAD' 

        # That is not sufficient. git will leave unversioned files and empty
        # directories. Clean them up manually in _didReset.
        command = ['reset', '--hard', head]
        if self.branch == "master":
            return self._dovccmd(command, self._initSubmodules)
            return self._dovccmd(command, self._didHeadCheckout)

Didn't look deep enough in the code to know if this has some unwanted side-effects.

comment:3 Changed 8 years ago by dustin

Changed 8 years ago by mattock

Backported fix to buildbot 0.8.5

comment:4 Changed 8 years ago by mattock

The backported fix was generated with

git-format-patch 300fbcf...6f5ce3b

It can be applied on top of buildbot installed with easy_install.

Note: See TracTickets for help on using tickets.