Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleted branches from other hosts are not cleaned up #1

Closed
rraval opened this issue Oct 30, 2021 · 0 comments
Closed

Deleted branches from other hosts are not cleaned up #1

rraval opened this issue Oct 30, 2021 · 0 comments

Comments

@rraval
Copy link
Owner

rraval commented Oct 30, 2021

Consider a situation with a single user and two hosts: host0 and host1

As an initial state, here are the refs:

origin host0 host1
refs/heads/master refs/heads/master refs/heads/master

host0 creates a new branch branch0 and syncs.

host0$ git branch branch0 master
host0$ git nomad sync
origin host0 host1
refs/heads/master refs/heads/master refs/heads/master
refs/nomad/user/host0/master refs/nomad/host0/master
refs/nomad/user/host0/branch0 refs/nomad/host0/branch0

host1 syncs, fetching refs about host0

host1$ git nomad sync
origin host0 host1
refs/heads/master refs/heads/master refs/heads/master
refs/nomad/user/host0/master refs/nomad/host0/master refs/nomad/host0/master
refs/nomad/user/host0/branch0 refs/nomad/host0/branch0 refs/nomad/host0/branch0
refs/nomad/user/host1/master refs/nomad/host1/master refs/nomad/host1/master

host0 now deletes the branch and syncs

host0$ git branch -d branch0
host0$ git nomad sync
origin host0 host1
refs/heads/master refs/heads/master refs/heads/master
refs/nomad/user/host0/master refs/nomad/host0/master refs/nomad/host0/master
refs/nomad/host0/branch0
refs/nomad/user/host1/master refs/nomad/host1/master refs/nomad/host1/master

host1 syncs again, but because we only do the equivalent of git fetch origin +refs/nomad/user/*:refs/nomad/*, it doesn't actually delete refs/nomad/host0/branch0:

host1$ git nomad sync
origin host0 host1
refs/heads/master refs/heads/master refs/heads/master
refs/nomad/user/host0/master refs/nomad/host0/master refs/nomad/host0/master
refs/nomad/host0/branch0
refs/nomad/user/host1/master refs/nomad/host1/master refs/nomad/host1/master

This has the annoying end result of monotonically accumulating refs from other hosts if those refs have ever been observed.

rraval added a commit that referenced this issue Nov 6, 2021
This allows future tests to use `branch0`, `branch1` etc. for whatever
they need.

Part of #1.
@rraval rraval closed this as completed in 6135c76 Nov 6, 2021
rraval added a commit that referenced this issue Dec 23, 2021
Also revealed a subtle issue where local and remote `NomadRef<GitRef>`
has slightly different `GitRef::name`s and thus were not compared as
equal when deciding whether the branch on another host was deleted (this
was a bug introduced by e2d3d58, which
itself was a fix for #2).

Use a dedicated `RemoteNomadRefSet` to eliminate this kind of mistake
entirely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant