From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: What's cooking in git.git (Aug 2025, #01; Sun, 3)
Date: Tue, 5 Aug 2025 15:05:24 +0200 [thread overview]
Message-ID: <aJIBlIDto33lJEuK@pks.im> (raw)
In-Reply-To: <xmqqectq4ne9.fsf@gitster.g>
On Mon, Aug 04, 2025 at 05:34:22PM -0700, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > I just left a rather lengthy review of the split-HEAD patch in v4. I
> > think hit has a few bugs that we need to address.
> >
> > I'm not sure if the right answer is to just go back to the v3 version
> > that simply rejected the racy HEAD update (since that's more or less
> > what happens now and nobody complains).
> >
> > If we do want to stick with the "silently skip the racy HEAD update"
> > strategy from v4, I left some fixes there. But I'd worry more about
> > maintainability and regressions in the future. I'm not sure if my hacky
> > "pretend the HEAD is this for splitting" patch is something we'd want to
> > carry or not. But if so, I think we could at least get a little coverage
> > in the test suite.
>
> Between the "honestry admit we failed and reject" and "silently
> pretend nothing bad happened", I'd have to say that the former may
> be more preferrable, and I hope people would agree.
I am a bit torn overall. We _are_ talking about a race, even though it
is an implicit race because the user didn't explicitly ask for the ref
to be updated. So aborting the transaction is reasonable from my
perspective. But as Peff noted the user didn't ask for it explicitly, so
it may be surprising if we abort due to a concurrent update of HEAD.
Ultimately I'd claim that no end user will ever see this happen in
practice. You'd have to change HEAD at the same point in time as you
write a new commit directly to the branch that it's pointing to. That
is, git-commit(1) wouldn't even be able to trigger this case as that
command commits to HEAD, not to its target. And just to confirm my
claim: setting a breakpoint in `split_head_update()` and then executing
"git commit" doesn't trigger that function.
So with that knowledge I'd rather do the safe thing and abort the
transaction. It requires less hard-to-test logic and feels safer
overall.
If we agree on that I can send a final reroll that reverts back to the
logic we had in v3, which did abort the transaction.
Patrick
next prev parent reply other threads:[~2025-08-05 13:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-04 8:23 What's cooking in git.git (Aug 2025, #01; Sun, 3) Junio C Hamano
2025-08-04 9:47 ` Patrick Steinhardt
2025-08-04 14:29 ` Junio C Hamano
2025-08-04 14:51 ` Patrick Steinhardt
2025-08-04 15:41 ` Jeff King
2025-08-05 0:34 ` Junio C Hamano
2025-08-05 12:51 ` Jeff King
2025-08-05 17:08 ` Junio C Hamano
2025-08-05 18:48 ` Jeff King
2025-08-05 13:05 ` Patrick Steinhardt [this message]
2025-08-05 13:44 ` Jeff King
2025-08-05 17:10 ` Junio C Hamano
2025-08-05 1:22 ` D. Ben Knoble
2025-08-05 10:24 ` Junio C Hamano
2025-08-05 16:23 ` D. Ben Knoble
2025-08-05 16:30 ` D. Ben Knoble
2025-08-05 19:06 ` Junio C Hamano
2025-08-05 19:18 ` Ben Knoble
2025-08-06 17:28 ` Lucas Seiki Oshiro
2025-08-06 18:34 ` Junio C Hamano
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=aJIBlIDto33lJEuK@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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;
as well as URLs for NNTP newsgroup(s).