(t *testing.T)
| 2025 | } |
| 2026 | |
| 2027 | func TestClientWorktreesListsRepositoryWorktrees(t *testing.T) { |
| 2028 | // Given a repository with a linked feature worktree |
| 2029 | repo := newTestRepo(t) |
| 2030 | repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "initial commit") |
| 2031 | repo.run(t, "branch", "feature") |
| 2032 | worktreeParent, err := filepath.EvalSymlinks(t.TempDir()) |
| 2033 | require.NoError(t, err) |
| 2034 | worktreeDir := filepath.Join(worktreeParent, "feature") |
| 2035 | repo.run(t, "worktree", "add", "--quiet", worktreeDir, "feature") |
| 2036 | |
| 2037 | // When repository worktrees are listed |
| 2038 | worktrees, err := repo.client.Worktrees(t.Context()) |
| 2039 | |
| 2040 | // Then the primary and linked worktrees are returned with their refs |
| 2041 | require.NoError(t, err) |
| 2042 | assert.Equal(t, []Worktree{ |
| 2043 | {Path: filepath.ToSlash(repo.dir), Ref: "refs/heads/trunk"}, |
| 2044 | {Path: filepath.ToSlash(worktreeDir), Ref: "refs/heads/feature"}, |
| 2045 | }, worktrees) |
| 2046 | } |
| 2047 | |
| 2048 | func TestClientWorktreeRemoveRemovesOptionLikePath(t *testing.T) { |
| 2049 | // Given a linked worktree whose relative path begins with a dash |
nothing calls this directly
no test coverage detected