Skip to content

A nested worktree belonging to a different repository #463

Description

@blooop

Question

A nested worktree belonging to a different repository: what should the sweep do with it?

Raised by the keystone decision on #445. Under the site-subtree unit this case is now reported rather than silently deleted, which is the important half and already better than the status quo. But it is unclassifiable by the sweep, so it stands forever and pins its parent standing with it, and the only reclaim path is --force-worktrees.

That is principle 1 behaving correctly and principle 2 going unserved, which is the trade this map is meant to make deliberately rather than by omission. So: is standing forever the right answer, or should devlaunch do more?

The facts that bear on it, from #448's findings: a nested worktree of another repository has its admin directory under that repository, its gitfile points there, and the containing clone cannot see its registration at all — so no prune in the containing clone ever reclaims it, and the containing repository has no way to ask about its state.

Candidates:

  1. Stands, reported, and that is the documented answer. Cheapest. Principle 2 is partly served by the report: the bytes are named even though nothing reclaims them.
  2. Read its gitfile and ask that repository about its cleanliness and reachability, then treat the answer as the verdict. Strictly more capable, and the cost is that the sweep now reaches outside the clone it was scoped to, which R1 in the map's Notes exists to prevent. Weigh whether "the repository this worktree names" is a legitimate widening of a scan domain or the first step of the thing R1 forbids.
  3. Treat the parent as uncollectable and say so once, rather than re-reporting a permanent condition on every run. Noise has a cost when the whole point is that somebody reads the output and acts.

Note the interaction with the container question on the sibling ticket: inside a container, the other repository's worktree may be perfectly readable, so the answer may differ by where --prune runs. Say so if it does.

How the answer gets tested: a fixture with a worktree of a second repository nested inside the first, asserting the verdict and that the parent's fate follows from it.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions