chiark / gitweb /
Always try to recover origin/HEAD in case it's not there
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 26 Jun 2014 11:03:51 +0000 (13:03 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 26 Jun 2014 11:03:51 +0000 (13:03 +0200)
fdroidserver/common.py

index bdc6da2e5fa80e0f8ccb6d8aad336bfee9e01c9d..3396e93a3acb99ef6a4dd2c7fc2c379dceebae72 100644 (file)
@@ -435,6 +435,10 @@ class vcs_git(vcs):
                 p = SilentPopen(['git', 'fetch', '--prune', '--tags', 'origin'], cwd=self.local)
                 if p.returncode != 0:
                     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
         # 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.