From: Toon Claes <toon@iotcl.com>
To: "Junio C Hamano" <gitster@pobox.com>, "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>, stsp <stsp2@yandex.ru>,
Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH v2] branch: report active bisect run when rejecting delete
Date: Tue, 28 Jul 2026 15:36:22 +0200 [thread overview]
Message-ID: <871pcndynd.fsf@emacs.iotcl.com> (raw)
In-Reply-To: <xmqqbjbtyd80.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
> René Scharfe <l.s.r@web.de> writes:
>
>> git branch refuses to delete branches that are currently checked out
>> with a message like this: "error: cannot delete branch 'foo' used by
>> worktree at '/path/of/worktree'". This can be confusing if it's an
>> internal checkout for git bisect. Report a more specific error in
>> that case to help users that might have forgotten their bisect run.
>>
>> Suggested-by: stsp <stsp2@yandex.ru>
>> Signed-off-by: René Scharfe <l.s.r@web.de>
>> ---
>> Changes since v2:
>> - Only report bisect runs as specific rejection reason for now.
Works for me.
>> - Leave rebasing unaddressed because I don't see how to formulate
>> clear and readable messages for those scenarios, yet.
>> - Collect all checkout reasons of all branches in a simple array for
>> easy use, e.g. to eventually address rebases or for git status.
That's handy for future use.
>> - Rebased onto the landed test_grep conversion.
>
> The scope of this patch has shrunk a bit. While the 'in use by a
> rebase' state is still recognized internally, unlike in the previous
> round, we guard users only against the 'in use by a bisect' state and
> the 'in use by being checked out' state.
>
> This is probably a good single step, so unless there are objections,
> let's mark the topic for 'next'.
Yeah, I agree it's a step in the right direction.
I've reviewed the patch and looks good to me.
To answer your other question:
> This reminds me of another recent discussion on rewriting a branch
> that is checked out elsewhere, where the "git history" command
> forgot to apply the same safety check:
>
> https://lore.kernel.org/git/e7dbcede-4486-459c-aa64-e44690e01fe0@gmail.com/
>
> We definitely need an easy-to-use API to determine consistently
> which branches are in use, and to teach all commands that repoint
> branch tips to use it to offer the same safety to users. The
> framework that this patch introduces might be a good starting point
> for that effort.
Yeah, there is definetly some overlap here. As far as I can tell this is
a good step in the direction of an API the git-history(1) can use.
--
Cheers,
Toon
prev parent reply other threads:[~2026-07-28 13:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-18 4:39 [PATCH] branch: report kind of checkout when rejecting delete René Scharfe
2026-07-18 17:34 ` Junio C Hamano
2026-07-18 19:07 ` René Scharfe
2026-07-18 22:09 ` Junio C Hamano
2026-07-19 5:55 ` René Scharfe
2026-07-19 9:50 ` Phillip Wood
2026-07-25 10:41 ` [PATCH v2] branch: report active bisect run " René Scharfe
2026-07-26 15:36 ` Junio C Hamano
2026-07-28 13:36 ` Toon Claes [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871pcndynd.fsf@emacs.iotcl.com \
--to=toon@iotcl.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
--cc=phillip.wood@dunelm.org.uk \
--cc=stsp2@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox