Jasper Mayone [off-list ref] writes:
This replaces my "git worktree list --branch" patch [1].
Then please label it as v3 as the old one is v2, or it breaks
automation.
In that
thread Kristoffer pointed out that "git for-each-ref --merged <commit>
--format='%(worktreepath)' refs/heads/" already finds the worktrees of
merged branches, so a new option is not needed. What is missing is
that %(worktreepath) ignores a branch while a worktree is rebasing or
bisecting it, although "git worktree add" and "git branch -d" already
treat that branch as checked out. Phillip agreed that this is a bug.
Ben then asked what happens if such a worktree is passed to "git
worktree remove". Today it is removed, and the rebase or bisect state
is lost with it, if the files happen to be clean. Phillip called that
a bug too, and more likely to be hit once %(worktreepath) reports
these worktrees, so it is fixed first.
All of these address great points. Thanks for working on it.