Skip to content

Widen the clone unpushed probe to every local ref #471

Description

@blooop

Work

Make the clone-level unpushed probe see every local ref, not one branch. This is a live data-loss fix in shipped code and it is independent of everything else on this map.

Today dl's unpushed answer is log --oneline <branch> --not --remotes everywhere. So commits on any other local branch in the clone are invisible. Commit on wip, switch to main, let dl <ws> rm delete the clone, and those commits are gone — with NothingToLose printed. Measured on #459 and again on #446.

Sliced out of #454 deliberately, on two grounds. It lives in a different module from the agent-worktree sweep that #454 rewrites, so there is no conflict. And it fixes a path a user can lose work on today, which under this map's first principle should not wait behind a large rewrite.

Scope:

  • --all in place of the single named branch at clone scope, so the probe reaches every local branch. What proves an agent worktree safe to remove, and what if it cannot be proved #446 measured that rev-list --all --not --remotes in a clone reaches every local branch, refs/stash, and every worktree's HEAD including detached ones.
  • Readers to check, because they all consume this answer: dl <ws> rm's refusal, --prune's orphan arm, and the --ls --json goldens that pin unsaved.
  • Red first, and the failing test is the point: a clone with commits on a non-checked-out local branch, asserting the guard reports them rather than NothingToLose. That test is the bug report.

Two things explicitly not here, so the boundary is clean. The nested-agent-worktree half of the same blindness (.claude/worktrees/ is gitignored, so status --porcelain sees nothing) belongs to #454, because it needs the site fold that ticket builds. And the verdict type itself (Collectable(Proof) | Stands(NonEmpty<Reason>)) is #454's — this ticket keeps the existing shape and only widens the ref set it asks about.

One thing worth stating in the code: refs/stash is shared, written to <clone>/.git/refs/stash even from inside a linked worktree, and reached by --all. Measured on #446. So widening to --all picks up stashes as a side effect, which is correct and should be deliberate rather than incidental.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions