DetectUserRole(repoPath) used repoPath for the git-config and URL lookups,
but the jj-secondary resolution underneath called the cwd-based
git.JJSecondaryWorkspaceRoot / GetJJPrimaryWorkspaceRoot (which bottom out
in GetJujutsuRoot -> os.Getwd). They only agreed because both callers pass
".". A caller passing a non-cwd repoPath would resolve the jj primary from
the wrong directory.
Add path-aware cores in internal/git:
- getJujutsuRootFrom(dir) walks from an explicit start dir, applying Abs first
so From(".") reproduces the cwd-based walk (and the .git-boundary stop)
exactly.
- JJSecondaryWorkspaceRootFrom / GetJJPrimaryWorkspaceRootFrom expose the
path-aware variants; the existing cwd-based functions are thin wrappers.
routing.DetectUserRole now calls the ...From(repoPath) variants so the jj
resolution stays consistent with the git-config lookup. beads.go is left
untouched — FindBeadsDir/findDatabaseInTree are inherently cwd-based, so their
use of the cwd helpers is correct.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| routing.go | ||
| routing_test.go | ||