mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-02 09:10:11 +02: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
@ -1167,6 +1167,9 @@ class vcs_git(vcs):
|
||||
p = self.git(['fetch', 'origin'], cwd=self.local)
|
||||
if p.returncode != 0:
|
||||
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)
|
||||
if p.returncode != 0:
|
||||
raise VCSException(_("Git fetch failed"), p.output)
|
||||
|
Loading…
Reference in New Issue
Block a user