Skip to content

Commit cf81348

Browse files
tae2089claude
andcommitted
test: pin git fixtures to main branch, not machine default
initBareRepo (gitrepo and webhook e2e) created the initial commit on whatever init.defaultBranch resolved to — master on machines where it is unset — while the tests request the "main" branch, so clone-by-branch failed with `couldn't find remote ref "refs/heads/main"`. Pass --initial-branch=main to `git init --bare` so the bare HEAD and initial branch are always main regardless of local git config. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent bc15269 commit cf81348

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

internal/adapters/inbound/webhook/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func initBareRepo(t *testing.T) string {
2020
t.Helper()
2121
dir := t.TempDir()
2222
bareDir := filepath.Join(dir, "bare.git")
23-
runTestGit(t, dir, "init", "--bare", bareDir)
23+
runTestGit(t, dir, "init", "--bare", "--initial-branch=main", bareDir)
2424
workDir := filepath.Join(dir, "work")
2525
runTestGit(t, dir, "clone", bareDir, workDir)
2626
if err := os.WriteFile(filepath.Join(workDir, "hello.txt"), []byte("hello"), 0o644); err != nil {

internal/adapters/outbound/gitrepo/checkout_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func initBareRepo(t *testing.T) string {
2727
}
2828
}
2929

30-
run("init", "--bare", bareDir)
30+
run("init", "--bare", "--initial-branch=main", bareDir)
3131

3232
workDir := filepath.Join(dir, "work")
3333
run("clone", bareDir, workDir)

0 commit comments

Comments
 (0)