From: Phillip Wood <phillip.wood123@gmail.com>
To: Aniket Gupta <aniketgupta3001@gmail.com>
Cc: git@vger.kernel.org, Patrick Steinhardt <ps@pks.im>,
Toon Claes <toon@iotcl.com>, Junio C Hamano <gitster@pobox.com>,
Phillip Wood <phillip.wood@dunelm.org.uk>,
Nikita Bobko <nikita@nbobko.com>
Subject: Re: [PATCH] history: refuse to rewrite branches used by other worktrees
Date: Tue, 24 Nov 2026 10:49:42 +0000 [thread overview]
Message-ID: <14c971ef-438c-4197-b0cd-df9bf0ef0ae4@gmail.com> (raw)
In-Reply-To: <20261123215431.27574-1-aniketgupta3001@gmail.com>
On 23/11/2026 21:54, Aniket Gupta wrote:
> Thanks for taking a look!
You're welcome, thanks for working on it.
>> What happens if a rebase is running in the same worktree as the user
>> tries to run "git history"?
>
> It is refused. HEAD is detached then, so the branch being rebased is not
> the one this worktree has checked out, and it gets treated like any
> other branch in use. There is a test for it, but the commit message does
> not contain this. Will fix.
>
> In that case --update-refs=head is not refused: it only rewrites the
> detached HEAD, same as before. I tried fixup, reword, drop and squash
> that way, and "git rebase --continue" finished fine each time.
That sounds like a bug though, because "git history" will update HEAD in
the middle of a rebase and we throw away the result of running "git
history" when "git rebase" completes.
>
>> We should also prevent rebase from rewriting a branch that is being
>> rewritten by "git history" but that can come later.
>
> Agreed, that can come later.
we should also refuse to run if another "git history" is rewriting the
same branches - that's also something for another time.
>> This is correct, but it duplicates the revision walk we're already
>> doing when looking for merge commits.
>
> Makes sense. I gave it a try and it works. One point: the branch
> pointing at the rewritten commit itself is not part of the walk, so I
> look at its decorations too.
Great, I realized that after I sent my mail yesterday, well spotted.
Thanks
Phillip
> Rewriting a commit that another worktree's
> branch points at goes through without it. Will do it like this in v2.
next prev parent reply other threads:[~2026-11-24 10:49 UTC|newest]
Thread overview: 22+ 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 [this message]
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
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
2026-12-01 16:39 ` Phillip Wood
2026-12-01 17:36 ` Aniket Gupta
2026-12-01 13:18 ` Patrick Steinhardt
2026-12-01 16:37 ` Phillip Wood
2026-12-02 6:23 ` Patrick Steinhardt
2026-12-01 18:11 ` 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=14c971ef-438c-4197-b0cd-df9bf0ef0ae4@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=aniketgupta3001@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nikita@nbobko.com \
--cc=phillip.wood@dunelm.org.uk \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.