Skip to content

Nested worktree guarantees and git worktree prune's real blast radius #448

Description

@blooop

Question

What does git actually guarantee about nested worktrees, and what is git worktree prune's real blast radius?

The unit decision should rest on git's semantics rather than on what eight probes happened to show. Establish, against a real git and with the version noted (the reviewer measured on 2.51):

  1. Nesting. What happens when a linked worktree is created inside another linked worktree? Where does its admin directory live, whose .git does its gitfile point at, and does the outer worktree's removal have any defined effect on the inner one? Is nesting a supported configuration at all, or merely one git does not refuse?
  2. Prune's scope. git worktree prune is invoked per repository. Confirm precisely which registrations it drops and which it spares: the review established it skips locked on 2.51, but does it spare anything else, and is --expire relevant? Is there any way to prune one registration, which would collapse the T2 mismatch outright?
  3. Removal from the host. With a registration whose path is a container path that does not resolve, what are the supported ways to drop just that registration without touching others? Is git worktree repair relevant, and what would it do to a container path?
  4. Locks. What exactly does a lock protect against, which commands honour it, and what does git say a lock means about liveness? dl --prune cannot reclaim agent worktrees inside live workspaces' clones (104 GB measured) #426 Ask 2 treats a lock as sacred; confirm that matches git's own contract rather than the agent harness's convention.
  5. Whether git worktree list --porcelain reports enough to distinguish registered and present, registered and absent, locked, and prunable without a second filesystem walk.

Findings onto a research/git-worktree-semantics branch, linked from this ticket. Facts and citations, not a design.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions