Skip to content

Commit 65c16e9

Browse files
MichielDeanCistern Agent
andauthored
fix: worktree_prune runs in _primary, not sandbox root (#98)
`git worktree prune` needs to run inside the git repo (`_primary/`). Running it in `sandboxes/ScaledTest/` fails with 'not a git repository'. Also skip if `_primary` doesn't exist yet. Co-authored-by: Cistern Agent <agent@cistern.local>
1 parent 2491cc3 commit 65c16e9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

internal/castellarius/drought_hooks.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,13 @@ func hookWorktreePrune(cfg *aqueduct.AqueductConfig, sandboxRoot string, logger
269269
continue
270270
}
271271

272+
// git worktree prune must run in the _primary clone, not the repo sandbox root.
273+
primaryDir := filepath.Join(dir, "_primary")
274+
if _, err := os.Stat(primaryDir); os.IsNotExist(err) {
275+
continue // _primary not yet cloned — skip silently
276+
}
272277
cmd := exec.Command("git", "worktree", "prune")
273-
cmd.Dir = dir
278+
cmd.Dir = primaryDir
274279
out, err := cmd.CombinedOutput()
275280
if err != nil {
276281
logger.Warn("worktree_prune: error", "repo", repo.Name, "error", err, "output", string(out))

0 commit comments

Comments
 (0)