diff --git a/tests/git_test.go b/tests/git_test.go index 790318a..0ac7ef8 100644 --- a/tests/git_test.go +++ b/tests/git_test.go @@ -47,6 +47,12 @@ func TestGitCloneAndFetch(t *testing.T) { t.Fatalf("git commit failed: %v", err) } + // Create main branch (required for worktree operations) + cmd = exec.Command("git", "-C", sourceDir, "checkout", "-b", "main") + if err := cmd.Run(); err != nil { + t.Fatalf("git checkout -b main failed: %v", err) + } + // Test clone into empty path ctx := context.Background() err := action.CloneRepoActivity(ctx, action.CloneRepoInput{ @@ -124,6 +130,12 @@ func TestGitWorktreeAdd(t *testing.T) { t.Fatalf("git commit failed: %v", err) } + // Create main branch (required for worktree operations) + cmd = exec.Command("git", "-C", sourceDir, "checkout", "-b", "main") + if err := cmd.Run(); err != nil { + t.Fatalf("git checkout -b main failed: %v", err) + } + // Clone the repo ctx := context.Background() err := action.CloneRepoActivity(ctx, action.CloneRepoInput{ @@ -186,6 +198,12 @@ func TestGitCommit(t *testing.T) { t.Fatalf("git commit failed: %v", err) } + // Create main branch (required for worktree operations) + cmd = exec.Command("git", "-C", sourceDir, "checkout", "-b", "main") + if err := cmd.Run(); err != nil { + t.Fatalf("git checkout -b main failed: %v", err) + } + // Clone the repo ctx := context.Background() err := action.CloneRepoActivity(ctx, action.CloneRepoInput{