A removed fork stays on the remote and comes back on the next fetch

MRMax Rakhimov ☐ · 2026-11-11 · 087a86bc06a6 open

gitsocial fork remove deletes only the local ref of the fork. gitmsg.RemoveFork calls git.DeleteRef for each refs/gitmsg/core/forks/<hash> ref of the fork and does nothing on the remote.

A push does not send the removal. gitmsg.PushWithProgress pushes the state refs with the refspec refs/gitmsg/*:refs/gitmsg/*, which adds and updates refs and never deletes one. After the removal, gitsocial push prints Nothing to push, and git ls-remote still shows the fork ref on origin.

A fetch reverses the removal. fetch.SyncWorkspaceOrigin fetches +refs/gitmsg/*:refs/gitmsg/* from origin, so the next fetch writes the fork ref again in the clone that removed it. Every other clone keeps the fork, and a clone that still has the ref restores it on the remote with its next push.

Seen with a workspace on a GitHub origin and one registered fork that the fetching account cannot read: each fetch of each clone logs a 403 for the fork, and no gitsocial command stops it.

Repair by hand: git push origin :refs/gitmsg/core/forks/<hash>, delete refs/remotes/origin/gitmsg/core/forks/<hash> in the clone, then run gitsocial fork remove in each other clone.

Not checked: other state that is one ref per element, a removed list member under refs/gitmsg/<ext>/lists/<name>/items/ and a decline marker under refs/gitmsg/core/declines/, can have the same fault. Read their remove paths before the fix.

The fix is a design question, because a deleted ref has no history: a clone cannot tell a ref that was deleted on purpose from a ref that it did not fetch yet. Options: a tombstone ref that a fetch honors; or a push that deletes on the remote each state ref that the tracking copy under refs/remotes/<remote>/gitmsg/ has and the local repository does not, with the fetch pruning the same way. The guide (REVIEW.md, CLI.md) names no limit for fork remove today; it must describe the result that the fix gives.

A test: remove a fork in one clone, push, fetch in a second clone, and the fork is in neither clone and not on the remote.