feat(context): centralize RepoContext API for git operations (#1102)

Centralizes repository context resolution via RepoContext API, fixing bugs where git commands run in the wrong repo when BEADS_DIR points elsewhere or in worktree scenarios.
This commit is contained in:
Peter Chanthamynavong
2026-01-15 07:55:08 -08:00
committed by GitHub
parent 159114563b
commit 0a48519561
33 changed files with 3211 additions and 327 deletions
+4
View File
@@ -972,6 +972,10 @@ func getRemoteForBranch(ctx context.Context, worktreePath, branch string) string
// GetRepoRoot returns the git repository root directory
// For worktrees, this returns the main repository root (not the worktree root)
// The returned path is canonicalized to fix case on case-insensitive filesystems (GH#880)
//
// Deprecated: Use beads.GetRepoContext().RepoRoot instead. GetRepoContext provides
// a unified API that correctly handles BEADS_DIR, worktrees, and redirects.
// This function will be removed in a future release.
func GetRepoRoot(ctx context.Context) (string, error) {
var repoRoot string