Always try to recover origin/HEAD in case it's not there

This commit is contained in:
Daniel Martí 2014-06-26 13:03:51 +02:00
parent 4ad7e8be06
commit e49b7aafda

View file

@ -435,6 +435,10 @@ class vcs_git(vcs):
p = SilentPopen(['git', 'fetch', '--prune', '--tags', 'origin'], cwd=self.local) p = SilentPopen(['git', 'fetch', '--prune', '--tags', 'origin'], cwd=self.local)
if p.returncode != 0: if p.returncode != 0:
raise VCSException("Git fetch failed") raise VCSException("Git fetch failed")
# Recreate origin/HEAD as git clone would do it, in case it disappeared
p = SilentPopen(['git', 'remote', 'set-head', 'origin', '--auto'], cwd=self.local)
if p.returncode != 0:
raise VCSException("Git remote set-head failed")
self.refreshed = True self.refreshed = True
# origin/HEAD is the HEAD of the remote, e.g. the "default branch" on # origin/HEAD is the HEAD of the remote, e.g. the "default branch" on
# a github repo. Most of the time this is the same as origin/master. # a github repo. Most of the time this is the same as origin/master.