(t *testing.T)
| 618 | } |
| 619 | |
| 620 | func TestInitRepositoryNotInGitRepo(t *testing.T) { |
| 621 | tmpDir := testutil.TempDir(t, "test-*") |
| 622 | |
| 623 | originalDir, err := os.Getwd() |
| 624 | if err != nil { |
| 625 | t.Fatalf("Failed to get current directory: %v", err) |
| 626 | } |
| 627 | defer func() { |
| 628 | _ = os.Chdir(originalDir) |
| 629 | }() |
| 630 | |
| 631 | if err := os.Chdir(tmpDir); err != nil { |
| 632 | t.Fatalf("Failed to change to temp directory: %v", err) |
| 633 | } |
| 634 | |
| 635 | // Don't initialize git repo - should fail for some operations |
| 636 | err = InitRepository(InitOptions{Verbose: false, Skill: true, Agent: true, MCP: true, CodespaceRepos: []string{}, CodespaceEnabled: false, Completions: false, CreatePR: false, RootCmd: nil}) |
| 637 | |
| 638 | // The function should handle this gracefully or return an error |
| 639 | // Based on the implementation, ensureGitAttributes requires git |
| 640 | if err == nil { |
| 641 | t.Log("InitRepository(, false, false, false, nil) succeeded despite not being in a git repo") |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | func TestInitRepositoryIdempotent(t *testing.T) { |
| 646 | tmpDir := testutil.TempDir(t, "test-*") |
nothing calls this directly
no test coverage detected