mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-16 16:02:33 +03:00
git prune branches in case of failure
git branches can be namespaces like directories on a filesystem and are represented like that. Due to that there can't be a branch with the same name as a namespace, i.e. foo and foo/bar. If upstream moves from a branch to namespace, we need to prune the old branch before fetching the new one. This broke organic maps: From https://github.com/organicmaps/organicmaps * [new branch] android/huawei -> origin/android/huawei error: cannot lock ref 'refs/remotes/origin/fixes/all': 'refs/remotes/origin/fixes' exists; cannot create 'refs/remotes/origin/fixes/all' ! [new branch] fixes/all -> origin/fixes/all (unable to update local ref) e2ac324b95..320a1db39b master -> origin/master * [new tag] 2021.10.09-2-android -> 2021.10.09-2-android error: some local refs could not be updated; try running 'git remote prune origin' to remove any old, conflicting branches
This commit is contained in:
parent
e8b7a648b7
commit
fa3cceb8e8
1 changed files with 3 additions and 0 deletions
|
@ -1167,6 +1167,9 @@ class vcs_git(vcs):
|
||||||
p = self.git(['fetch', 'origin'], cwd=self.local)
|
p = self.git(['fetch', 'origin'], cwd=self.local)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise VCSException(_("Git fetch failed"), p.output)
|
raise VCSException(_("Git fetch failed"), p.output)
|
||||||
|
p = self.git(['remote', 'prune', 'origin'], output=False, cwd=self.local)
|
||||||
|
if p.returncode != 0:
|
||||||
|
raise VCSException(_("Git prune failed"), p.output)
|
||||||
p = self.git(['fetch', '--prune', '--tags', '--force', 'origin'], output=False, cwd=self.local)
|
p = self.git(['fetch', '--prune', '--tags', '--force', 'origin'], output=False, cwd=self.local)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise VCSException(_("Git fetch failed"), p.output)
|
raise VCSException(_("Git fetch failed"), p.output)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue