Git development
 help / color / mirror / Atom feed
From: Aniket Gupta <aniketgupta3001@gmail.com>
To: Toon Claes <toon@iotcl.com>, git@vger.kernel.org
Cc: Patrick Steinhardt <ps@pks.im>,
	Junio C Hamano <gitster@pobox.com>,
	Phillip Wood <phillip.wood123@gmail.com>,
	Nikita Bobko <nikita@nbobko.com>
Subject: Re: [PATCH v2] history: refuse to rewrite branches used by other worktrees
Date: Mon, 30 Nov 2026 17:45:18 +0530	[thread overview]
Message-ID: <20261130121518.70958-1-aniketgupta3001@gmail.com> (raw)
In-Reply-To: <87qzg2r1wj.fsf@dev.null.iotcl.com.invalid>

> 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.

  reply	other threads:[~2026-11-30 12:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:39 [PATCH] history: refuse to rewrite branches used by other worktrees Aniket Gupta
2026-11-23 13:10 ` Phillip Wood
2026-11-23 21:54   ` Aniket Gupta
2026-11-24 10:49     ` Phillip Wood
2026-11-24 14:09       ` Aniket Gupta
2026-11-23 20:14 ` Junio C Hamano
2026-11-23 21:54   ` Aniket Gupta
2026-11-27 17:32 ` [PATCH v2] " Aniket Gupta
2026-11-28  0:12   ` Junio C Hamano
2026-11-28  7:37     ` Aniket Gupta
2026-11-30 11:31   ` Toon Claes
2026-11-30 12:15     ` Aniket Gupta [this message]
2026-11-30 14:39     ` Phillip Wood
2026-11-30 17:13       ` Aniket Gupta
2026-11-30 14:49   ` Phillip Wood
2026-11-30 17:13     ` Aniket Gupta

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=20261130121518.70958-1-aniketgupta3001@gmail.com \
    --to=aniketgupta3001@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=nikita@nbobko.com \
    --cc=phillip.wood123@gmail.com \
    --cc=ps@pks.im \
    --cc=toon@iotcl.com \
    /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