(t *testing.T)
| 2046 | } |
| 2047 | |
| 2048 | func TestClientWorktreeRemoveRemovesOptionLikePath(t *testing.T) { |
| 2049 | // Given a linked worktree whose relative path begins with a dash |
| 2050 | repo := newTestRepo(t) |
| 2051 | repo.run(t, "commit", "--quiet", "--allow-empty", "-m", "initial commit") |
| 2052 | repo.run(t, "branch", "feature") |
| 2053 | repo.run(t, "worktree", "add", "--quiet", "--", "-feature", "feature") |
| 2054 | |
| 2055 | // When the option-like path is removed |
| 2056 | err := repo.client.WorktreeRemove(t.Context(), "-feature") |
| 2057 | |
| 2058 | // Then the option separator protects the path and the worktree is removed |
| 2059 | require.NoError(t, err) |
| 2060 | _, statErr := os.Stat(filepath.Join(repo.dir, "-feature")) |
| 2061 | require.ErrorIs(t, statErr, os.ErrNotExist) |
| 2062 | worktrees, listErr := repo.client.Worktrees(t.Context()) |
| 2063 | require.NoError(t, listErr) |
| 2064 | assert.Nil(t, WorktreeForBranch(worktrees, "feature")) |
| 2065 | } |
| 2066 | |
| 2067 | func TestClientWorktreePruneRemovesMissingWorktreeMetadata(t *testing.T) { |
| 2068 | // Given a linked worktree whose directory was removed outside Git |
nothing calls this directly
no test coverage detected