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:
committed by
GitHub
parent
159114563b
commit
0a48519561
@@ -6,6 +6,9 @@ import (
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/steveyegge/beads/internal/beads"
|
||||
"github.com/steveyegge/beads/internal/git"
|
||||
)
|
||||
|
||||
func TestMigrateSyncValidation(t *testing.T) {
|
||||
@@ -96,6 +99,13 @@ func TestMigrateSyncDryRun(t *testing.T) {
|
||||
// Note: We need to run this from tmpDir context since branchExistsLocal uses git in cwd
|
||||
ctx := context.Background()
|
||||
t.Chdir(tmpDir)
|
||||
// Reset caches so RepoContext picks up new CWD
|
||||
beads.ResetCaches()
|
||||
git.ResetCaches()
|
||||
defer func() {
|
||||
beads.ResetCaches()
|
||||
git.ResetCaches()
|
||||
}()
|
||||
|
||||
if branchExistsLocal(ctx, "beads-sync") {
|
||||
t.Error("branchExistsLocal should return false for non-existent branch")
|
||||
|
||||
Reference in New Issue
Block a user