Re: bug report: spurious "cannot delete branch '%s' used by worktree"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 31, 2024 at 7:49 AM Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
>
> [please reply inline rather than top-posting; I've moved your reply
> inline for this response]
>
> On Thu, Mar 28, 2024 at 1:40 PM Tamir Duberstein <tamird@xxxxxxxxxxxxxx> wrote:
> > On Thu, Mar 28, 2024 at 5:24 PM Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> > > On Thu, Mar 28, 2024 at 10:54 AM Tamir Duberstein <tamird@xxxxxxxxxxxxxx> wrote:
> > > > % git branch -d cleanup
> > > > error: cannot delete branch 'cleanup' used by worktree at '<my source dir>'
> > > > % git worktree list
> > > > <my source dir>  dc46f6d5e [main]
> > > > % git branch
> > > >   cleanup
> > > > * main
> > >
> > > Is this error persistent once it arises? That is, if you invoke `git
> > > branch -d cleanup` again immediately after (or a little while after)
> > > the above sequence, does the problem persist? Or does it "clear up" on
> > > its own at some point?
> >
> > Yes, the problem is persistent. The branch is never deleted.
>
> I'd guess that there may be some sort of "ref" still pointing at the
> "cleanup" branch which presumably was, at some point, checked out at
> "<my source dir>". Digging through the code[1,2,3] suggests that you
> might have some stale state from a rebase, bisect, or other sequencer
> operation which still references the "cleanup" branch.
>
> [Cc'ing Phillip who is probably much more familiar with this code than am I.]
>
> By the way, it's not clear from your initial report what you mean when
> you say "then the remote deleted the branch". Also, did you fetch
> and/or pull from the remote after that?
>
> [1]: https://github.com/git/git/blob/d6fd04375f91/branch.c#L454
> [2]: https://github.com/git/git/blob/d6fd04375f91/branch.c#L386
> [3]: https://github.com/git/git/blob/d6fd04375f91/sequencer.c#L6551

Thanks, I wasn't aware of the etiquette.

I had used the branch to send a pull request on GitHub, and then
deleted the remote branch from GitHub after merging the pull request.
Yes, I have fetched from the remote following that. I've also manually
removed the remote tracking branch. Symptoms remain unchanged.

If you can suggest where to go looking for stale state, I'm happy to
provide more information. I'll take a look at the code references as
well.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux