fix: prune maintenance — the pool HEAD's branch config is not an orphan - #36
Merged
zheng-weihao merged 2 commits intoAug 14, 2026
Merged
Conversation
The orphan-config reap judged sections purely by ref existence, so an empty repo's clone-written default section (its branch is unborn by definition) was reaped on every bare prune — yet that section is the pool's live first-push routing, not residue. Exempt the branch named by the pool's HEAD symref (git symbolic-ref --short HEAD). The protection tracks HEAD: it self-releases when HEAD moves or when a ref materializes. In non-empty repos it is invisible, since the ref check already keeps such sections. Premise (documented in code): no orbit command ever detaches the pool HEAD, so the symref always names the default branch; on a detached HEAD the exemption silently no-ops. bats: the two empty-repo cases updated to the new criterion (scoped + default sections survive while the worktree lives; after reclaim only the scoped section is reaped) and a new case pins the behavior with a non-main default (dev). tests/09_prune.bats 101/101 green. Docs: spec-warnings criterion and spec-lifecycle orphan-config bullet restated. Signed-off-by: Zheng Weihao <zheng-weihao@outlook.com>
…li#36) Signed-off-by: Zheng Weihao <zheng-weihao@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Pool maintenance's orphan-config reap (
orbit prune's closing sweep) judges abranch.<name>.*section purely by ref existence. For an empty repo, the clone-written default-branch section (e.g.branch.master.*) can never have a ref — the branch is unborn by definition — so every bareorbit prunereaps it, even though that section is the pool's live first-push routing (upstream wiring for the firstgit push), not residue.The checked-out-branch guard from #33 deliberately left the pool's own checkout unprotected ("stays reapable"). That is fine for genuine residue but misfires on healthy empty repos: the default section is reaped while the repo sits there legitimately unborn.
Change
Exempt the branch named by the pool's HEAD symref (
git symbolic-ref --short HEAD) from the orphan-config reap:master/main.synconly fetches;add/switchonly touch worktrees), so the symref read always names the default branch; on a detached HEAD the exemption silently no-ops.Verification
tests/09_prune.bats101/101 green:maindefault branch (dev).master/dev) — default sections survive, an injected genuine-orphan section is still reaped, scoped worktree sections untouched.Docs:
docs/spec-warnings.mdcriterion row anddocs/spec-lifecycle.mdorphan-config bullet restated to the HEAD-target semantics.