Ticket #2127 (closed defect: fixed)

Opened 20 months ago

Last modified 16 months ago

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
Cc:

Description

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

buildbot_ticket_2127.patch Download (2.0 KB) - added by mattock 16 months ago.
Backported fix to buildbot 0.8.5

Change History

comment:1 Changed 20 months ago by dustin

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

Fix is merged - thanks for spotting that!

comment:2 Changed 20 months 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
        else:
            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)
        else:
            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 18 months ago by dustin

This was fixed in 6f5ce3b2ab033338f3ad7ddccbf8b6542311f70b.

Changed 16 months ago by mattock

Backported fix to buildbot 0.8.5

comment:4 Changed 16 months 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.