Skip to content

fix(cmd): resolve main repo root for pool commands run inside a worktree - #97

Closed
kunchenguid wants to merge 1 commit into
mainfrom
cursor/rebase-pr51-pool-resolution-a83f
Closed

kunchenguid wants to merge 1 commit into
mainfrom
cursor/rebase-pr51-pool-resolution-a83f

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

This is a conflict-resolved rebase of #51 onto current main. It does not close #51.

Original PR: #51 (fork head thirdreplicator:fix/pool-resolution-inside-worktree).

Behavior (unchanged from #51)

get, status, prune, init, and return (cwd fallback) resolve the owning repository via git-common-dir (FindMainRepoRoot / FindMainRepoRootFrom) so commands run inside a managed worktree use the same pool as the main repo. This matters most when there is no origin, because the pool name is hashed from the repo path.

The e2e regression TestCommandsInsideWorktreeUseMainRepoPool covers a remote-less repo: status inside the worktree must see the leased worktree, get inside the worktree must acquire from the same pool, and no ghost pool directory may appear.

Conflict resolution only

Cherry-pick of 7fd12a0 onto current main conflicted in cmd/get.go and cmd/e2e_test.go:

FindRepoRoot() is retained. #51 deleted it because it became unused on that branch; current main still uses it from enter (added after #51). Changing enter would expand scope, so it is left as on main.

No other behavior changes.

Open in Web Open in Cursor 

get, status, prune, init, and return's cwd fallback used the current
worktree's own toplevel as the repo root. For repositories without an
origin remote the pool name is hashed from that path, so running any of
these commands inside a managed worktree resolved to a fresh, empty
ghost pool ("No worktrees in pool" right after a successful get).

Route them through the new git.FindMainRepoRoot, which resolves a
linked worktree back to its owning repository (same mechanism destroy
and return-with-path already used), and drop the now-unused
git.FindRepoRoot.

Co-Authored-By: Claude Fable 5 <[email protected]>

Co-authored-by: Kun Chen <[email protected]>
@kunchenguid
kunchenguid marked this pull request as ready for review August 19, 2026 17:23
@kunchenguid

Copy link
Copy Markdown
Owner Author

Speaking as Kun's firstmate: this is the conflict-only rebase of #51 (thanks @thirdreplicator). CI is green (check plus test on ubuntu, macos, and windows). Triggering review.

@greptileai

@kunchenguid

Copy link
Copy Markdown
Owner Author

No description provided.

@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge, with the changed commands consistently selecting the owning repository’s pool from linked worktrees.

The new wrapper delegates to the existing main-repository resolver, the command changes consistently feed that root into established configuration and pool paths, and the regression test verifies the principal remote-less worktree failure mode.

Reviews (1): Last reviewed commit: "fix(cmd): resolve main repo root for poo..." | Re-trigger Greptile

@kunchenguid

Copy link
Copy Markdown
Owner Author

Speaking as Kun's firstmate: abandoning this sibling PR. We are landing the conflict-only rebase on #51 itself instead of keeping a second PR. Do not merge #97.

@kunchenguid

Copy link
Copy Markdown
Owner Author

No description provided.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants