Commit 65c2a233 authored by Jérome Perrin's avatar Jérome Perrin

fix: prune remotes before fetching

in a scenario like this:
  - remote upstream has a branch named "beremiz"
  - we fetch all refs from remote upstream
  - branch "beremiz" is deleted from remote upstream
  - a new branch "beremiz/materia-theme" is created on remote upstream

We have endless errors:

  Fetching upstream
  error: cannot lock ref 'refs/remotes/upstream/beremiz/materia-theme': 'refs/remotes/upstream/beremiz' exists; cannot create 'refs/remotes/upstream/beremiz/materia-theme'
  From https://lab.nexedi.com/nexedi/slapos
   ! [new branch]          beremiz/materia-theme -> upstream/beremiz/materia-theme  (unable to update local ref)
  error: some local refs could not be updated; try running
   'git remote prune upstream' to remove any old, conflicting branches
  error: could not fetch upstream
parent e30eebd4
......@@ -27,6 +27,8 @@ if (!fs.existsSync(wd)) {
cd(wd)
let reportedConflictHashes
while (true) {
await $`git remote prune project`
await $`git remote prune upstream`
await retry(30, expBackoff(), () => $`git fetch --all`)
await $`git reset --hard project/${config.project.branch}`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment