> By reading the comment above is_shared_symref() I've noticed this > leaves a gap open. When a branch is checked out in another worktree, > but has an ongoing rebase or bisect, it is not detected.
Thanks. I indeed can repro this. "git history drop --update-refs=head second" exits 0 and moves 'other', and the rebase in wt then fails with the "cannot lock ref" error which you showed. A rebase or bisect of the branch itself is detected. I checked both. The gap is a branch that another worktree's "rebase --update-refs" is going to update. The default mode misses it as well when the other worktree rebases a detached HEAD.
> I realize this is pretty much an edge case, and I'm not saying you > should address that gap in is_shared_symref() in this series, but I > think it's worthwhile to mention that in the commit message.
I think I can close it in builtin/history.c by also looking at the update-refs state of the other worktrees, so I will try that in v3 with your test. If it turns out to be bigger than that, I will mention it in the commit message as you suggested.
> There are situations where using '--update-refs=head' would not help. > For example when a branch is checked out in another worktree (using > --force), or when you're operating on a bare repository.
True. Can repro both when the branch is the one HEAD points to. It also happens when the current worktree is in the middle of a rebase. In v3, I will not show the hint when --update-refs=head would refuse too.