Skip to content

Handle worktree paths with spaces in /clean_gone - #81261

Open
fallintoplace wants to merge 1 commit into
anthropics:mainfrom
fallintoplace:fix/clean-gone-worktree-paths
Open

Handle worktree paths with spaces in /clean_gone#81261
fallintoplace wants to merge 1 commit into
anthropics:mainfrom
fallintoplace:fix/clean-gone-worktree-paths

Conversation

@fallintoplace

Copy link
Copy Markdown

What this does

Updates /clean_gone to discover gone branches with git for-each-ref and parse linked worktrees with git worktree list --porcelain -z.

The current command reads the column-oriented worktree output with awk. For a linked worktree at /tmp/my project/feature, it resolves only /tmp/my, so removal fails and the branch remains checked out. The $1 expression in awk is also interpreted as a positional command argument before the shell command runs.

Using the structured formats keeps branch matching exact and preserves complete worktree paths.

How we know it works

  • Ran the exact command against a repository containing both a regular gone branch and a linked worktree at a path with spaces.
  • Verified the linked branch feature/test.v1 and its worktree were removed.
  • Verified the regular gone branch was removed and main was preserved.
  • Checked the embedded command with bash -n.
  • Ran git diff --check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant