-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
Create an origin:
$ mkdir origin
$ cd origin
$ git init
$ touch myfile
$ git add myfile
$ git commit -m initial
$ cd ..Clone it for a host0 and sync:
$ git clone origin host0
$ cd host0
$ git nomad init --host host0
$ git nomad sync
$ cd ..Make another clone for host1 and sync:
$ git clone origin host1
$ cd host1
$ git nomad init --host host1
$ git nomad sync
$ cd ..Go into the origin and verify that there are refs from both hosts:
$ cd origin
$ git show-ref
a315634c2be1a910626ae24e1715a848909387bb refs/heads/master
a315634c2be1a910626ae24e1715a848909387bb refs/nomad/rraval/host0/master
a315634c2be1a910626ae24e1715a848909387bb refs/nomad/rraval/host1/master
$ cd ..Bugs 1 & 2
Go into host1 and try to prune the refs for host0:
$ cd host1
$ git nomad -vv prune --host host0
# Resolving .git directory
$ "git" "rev-parse" "--absolute-git-dir"
# Get config nomad.user
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "config" "--local" "--default" "" "--get" "nomad.user"
# Get config nomad.host
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "config" "--local" "--default" "" "--get" "nomad.host"
# Fetching branches from origin
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "fetch" "origin" "+refs/nomad/rraval/*:refs/nomad/*"
# Listing branches at origin
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "ls-remote" "origin" "refs/nomad/rraval/*"
# Fetching all refs
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "show-ref"
# Pruning branches at origin
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "push" "--no-verify" "origin" ":refs/nomad/rraval/host1/master"
# Delete refs/nomad/host0/master (was a315634c2be1a910626ae24e1715a848909387bb)
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "update-ref" "-d" "refs/nomad/host0/master" "a315634c2be1a910626ae24e1715a848909387bb"Note that the git push that delete refs is talking about host1 for some reason:
# Pruning branches at origin
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "push" "--no-verify" "origin" ":refs/nomad/rraval/host1/master"
However, the deleting of the local ref seems to be done correctly for host0:
# Delete refs/nomad/host0/master (was a315634c2be1a910626ae24e1715a848909387bb)
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "update-ref" "-d" "refs/nomad/host0/master" "a315634c2be1a910626ae24e1715a848909387bb"
Bug 1: The host1 ref is deleted at the remote instead of the host0 ref.
Bug 2: The host0 ref continues to exist on the remote.
$ git -C origin show-ref
git -C origin show-ref
a315634c2be1a910626ae24e1715a848909387bb refs/heads/master
a315634c2be1a910626ae24e1715a848909387bb refs/nomad/rraval/host0/masterBug 3
Back to host1, pruning all the nomad refs fails:
$ cd host1
$ git nomad -vv prune --all
# Resolving .git directory
$ "git" "rev-parse" "--absolute-git-dir"
# Get config nomad.user
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "config" "--local" "--default" "" "--get" "nomad.user"
# Get config nomad.host
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "config" "--local" "--default" "" "--get" "nomad.host"
# Fetching branches from origin
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "fetch" "origin" "+refs/nomad/rraval/*:refs/nomad/*"
# Listing branches at origin
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "ls-remote" "origin" "refs/nomad/rraval/*"
# Fetching all refs
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "show-ref"
# Pruning branches at origin
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "push" "--no-verify" "origin" ":refs/nomad/rraval/host1/master" ":refs/nomad/rraval/host1/master"
Error: command failure
$ "git" "--git-dir" "/home/rraval/tmp/host1/.git" "push" "--no-verify" "origin" ":refs/nomad/rraval/host1/master" ":refs/nomad/rraval/host1/master"
# Exit code: Some(1)
# ---- STDERR ----
error: dst ref refs/nomad/rraval/host1/master receives from more than one src
error: failed to push some refs to '/home/rraval/tmp/origin'
The push line mentions refs/nomad/rraval/host1/master twice, when it should be host0!
Metadata
Metadata
Assignees
Labels
No labels