fix(git-clean): strip the '+' other-worktree marker too #144

Merged
rootiest merged 1 commits from fix/clean-worktree-branch-marker into main 2026-09-10 01:15:44 +00:00
Owner

Summary

git branch -vv marks column 1 with + (not *) for a branch checked out in another linked worktree — distinct from * for the current worktree's own branch. git-clean's parser only stripped *:

gsub(/\*/, "")

so a gone branch shown with the + marker left the bogus token + glued onto $1. That entry then went into $gone_branches and failed to delete:

error: branch '+' not found

(Reported after merging #142/#143: feat/mkrep-command was checked out in a linked worktree while its remote tracking branch got deleted, which is exactly this shape.)

Fix

Strip either leading marker instead of just *:

sub(/^[*+]/, "")

Testing

  • Added a regression case to tests/test-network-fish.fish's existing git-clean mock-handler coverage, reproducing a +-marked gone-branch line and asserting it deletes cleanly with no branch '+' not found error.
  • fish tests/run-tests.fish: 697/697 assertions passed (242/242 files pass syntax + indent check)
  • python3 docs/verify-manual.py: 76/76 passed
## Summary `git branch -vv` marks column 1 with `+` (not `*`) for a branch checked out in *another* linked worktree — distinct from `*` for the current worktree's own branch. `git-clean`'s parser only stripped `*`: ``` gsub(/\*/, "") ``` so a gone branch shown with the `+` marker left the bogus token `+` glued onto `$1`. That entry then went into `$gone_branches` and failed to delete: ``` error: branch '+' not found ``` (Reported after merging #142/#143: `feat/mkrep-command` was checked out in a linked worktree while its remote tracking branch got deleted, which is exactly this shape.) ## Fix Strip either leading marker instead of just `*`: ``` sub(/^[*+]/, "") ``` ## Testing - Added a regression case to `tests/test-network-fish.fish`'s existing `git-clean` mock-handler coverage, reproducing a `+`-marked gone-branch line and asserting it deletes cleanly with no `branch '+' not found` error. - `fish tests/run-tests.fish`: 697/697 assertions passed (242/242 files pass syntax + indent check) - `python3 docs/verify-manual.py`: 76/76 passed
rootiest added the Kind/BugArea/Functions labels 2026-09-10 01:14:22 +00:00
rootiest added 1 commit 2026-09-10 01:14:23 +00:00
git branch -vv marks column 1 with '+' (not '*') for a branch checked
out in another linked worktree. Only '*' was stripped from $1, so a
gone branch shown with '+' left a bogus "+" entry in $gone_branches
that then failed to delete: error: branch '+' not found.

Add a regression case reproducing the '+'-marked gone-branch line via
the existing git-clean mock handler in tests/test-network-fish.fish.
rootiest merged commit 6732a71eb7 into main 2026-09-10 01:15:43 +00:00
rootiest deleted branch fix/clean-worktree-branch-marker 2026-09-10 01:15:44 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rootiest/fish-config#144