Skip to content

Commit a8884ef

Browse files
peyton-altclaude
andcommitted
test(enable): assert on the resolved hooks path, not the configured value
Copilot review follow-up: the error prints the path resolved via git rev-parse --git-path hooks, which may normalize separators on Windows; assert against GetHooksDir's result so the test matches what the error actually contains. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 34506cc commit a8884ef

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

cmd/entire/cli/strategy/hooks_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,13 @@ func TestInstallGitHook_HooksPathNotADirectory(t *testing.T) {
346346
ClearHooksDirCache()
347347
paths.ClearWorktreeRootCache()
348348

349+
// Assert against the resolved hooks dir (what the error prints), not the
350+
// configured value — git may normalize separators on Windows.
351+
resolvedHooksDir, resolveErr := GetHooksDir(ctx)
352+
if resolveErr != nil {
353+
t.Fatalf("GetHooksDir() failed: %v", resolveErr)
354+
}
355+
349356
_, err := InstallGitHook(ctx, true, false, false)
350357
if err == nil {
351358
t.Fatal("InstallGitHook() should fail when hooks path is not a directory")
@@ -354,8 +361,8 @@ func TestInstallGitHook_HooksPathNotADirectory(t *testing.T) {
354361
if !strings.Contains(msg, "core.hooksPath") {
355362
t.Errorf("error should name core.hooksPath, got: %s", msg)
356363
}
357-
if !strings.Contains(msg, hooksPath) {
358-
t.Errorf("error should include the resolved hooks path %s, got: %s", hooksPath, msg)
364+
if !strings.Contains(msg, resolvedHooksDir) {
365+
t.Errorf("error should include the resolved hooks path %s, got: %s", resolvedHooksDir, msg)
359366
}
360367
if !strings.Contains(msg, "git config") {
361368
t.Errorf("error should tell the user how to inspect/fix the setting, got: %s", msg)

0 commit comments

Comments
 (0)