Commit efb3a81
fix(finish): use repo_root for agent_worktree_root in submodule repos (#646)
* fix(locks): see claims written by a submodule under a linked worktree
`git worktree list` inside a submodule that lives in a LINKED worktree
reports the gitdir (<parent>/.git/worktrees/<wt>/modules/<sub>) as the
worktree path, not the actual working tree. load_all_locks only read
lock files from those reported roots, so validate could not see claims
the same checkout had just recorded — agent commits in such submodules
were always blocked ("staged files must be safely claimed").
Always include the caller's resolved repo_root in the roots list.
Regression test: parent repo + submodule + linked worktree; claim then
validate from inside the worktree's submodule (fails without the fix,
11/11 suite pass with it).
* refactor(locks): move the repo_root guard into list_worktree_roots
Review follow-up: cmd_status iterates list_worktree_roots directly, so
the gitdir-quirk fix in load_all_locks left `gx locks status` blind to
the same submodule-under-linked-worktree claims. Hoist the guard into
list_worktree_roots so every caller (claim conflict scan, validate,
status) sees the caller's own lock file; load_all_locks drops its local
copy of the guard.
* fix(finish): use repo_root for agent_worktree_root in submodule repos
In a git submodule, repo_common_root resolves to the parent's
.git/modules/<sub> directory, not the submodule working tree.
agent-branch-start.sh builds the worktree path with repo_root,
so agent-branch-finish.sh must match. When the paths diverge the
cleanup condition never fires, worktree removal is silently
skipped, and git branch -d fails with 'used by worktree'.
---------
Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>1 parent cc3d198 commit efb3a81
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
| 494 | + | |
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
| |||
0 commit comments