From: Patrick Steinhardt <ps@pks.im>
To: Maciej Ciemborowicz <maciej.ciemborowicz@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com, karthik.188@gmail.com
Subject: Re: [PATCH v2] refs: run copy and rename through transactions
Date: Mon, 5 Oct 2026 08:03:07 +0200 [thread overview]
Message-ID: <asM9m-_ZoX_5UQ-I@pks.im> (raw)
In-Reply-To: <CACQ=SRGSEsbNz3v3obd3JUOs2MrROnvuHkx1Dm51seCcv+12Cw@mail.gmail.com>
On Fri, Oct 02, 2026 at 04:16:08PM +0200, Maciej Ciemborowicz wrote:
> On Fri, Oct 2, 2026 at 12:56 PM Patrick Steinhardt <ps@pks.im> wrote:
> > why can't we make this whole mechanism completely agnostic of the
> > backend and implement this via pure transactions?
>
> The part I was trying to preserve is the existing reflog semantics. A
> normal ref transaction can express the logical ref updates. In example
> deleting the old ref and creating/updating the destination. But branch
> rename/copy also moves or copies the existing reflog history. For the
> files backend that currently involves filesystem-level reflog
> rename/copy and D/F handling, while reftable represents the same
> operation differently. So my assumption was that the logical ref
> updates could go through the generic transaction API, while the
> reflog-history operation would remain backend-specific.
Yes, the reflog semantics should of course stay the same. But nowadays,
this would also be achievable with only backend-agnostic logic as the
reference transactions have learned to write many reflog entries for a
single reference. This was added back when we introduced the migration
logic to convert between two different backends.
Now there's potentially two caveats:
- I don't think we have a way to delete many old reflog entries yet.
- There may be a significant impact on performance.
The question thus is whether we can avoid or fix those caveats somehow
and thus arrive at a more future-proof mechanism.
> > Is this new behaviour? Is this retaining old behaviour?
>
> The source/destination revalidation is new validation required by
> introducing the preparing hook before the backend locks are taken. The
> hook can itself change one of the refs. Without revalidation, the hook
> payload could describe one state while the rename/copy later operates
> on another state. The intention is therefore to reject an operation
> when the state observed by the preparing hook is no longer the state
> being committed.
I don't feel like that's sensible. The "preparing" hook is explicitly
run before we perform locking and is documented as such. So it is fully
expected that the on-disk state may still change between executing this
and the "prepared" phase. It is the responsibility of the hook author to
handle such cases, we shouldn't do this ourselves as we're now starting
to assume semantics of the hook itself.
> > Sorry, but I'm going to stop reading here. This is not in a state that
> > is reviewable and has way too much stuff that is obviously generated by
> > an AI without much thought being put into it by the author. I don't want
> > to invest my time into a topic where the author has obviously not spent
> > their time thinking about it, either.
>
> I'm really sorry to hear that. Yes, the patches I prepared were
> AI-assisted, but I do feel that I understand what I am doing. I would
> appreciate some understanding, though, as I do not work with C on a
> daily basis. The bug report and my attempt to fix it came from the
> fact that I am working on a Ruby gem for per-branch and per-worktree
> containerization. That is why I had to write git-hooks-ext, which is
> how I ended up running into this bug in the first place.
>
> I am not insisting that my patch should be merged. I simply thought
> that submitting a patch might help get the bug fixed faster, and
> getting the bug fixed is what I care about most. Karthik Nayak offered
> to help fix it, so perhaps it would be better for someone who works
> with C on a daily basis to take it over.
>
> I can, of course, also prepare a v3, split it into more commits, and
> explain my reasoning more clearly. But I cannot guarantee that it will
> meet your standards, simply because I am not yet familiar with them.
I'd suggest to iterate then. In the current version this patch is not in
a shape that is ready for review. The patch needs to be split up, and
there are a lot of gaps in the commit message. Taken together that gives
the signal that you don't really understand what you are doing.
That doesn't mean that you cannot fix that with another iteration
though. But I'd suggest to take your time prepping the next iteration to
read through the code, understand the concepts and doubt what AI spits
out.
Thanks!
Patrick
next prev parent reply other threads:[~2026-10-05 6:03 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 13:33 [BUG] reference-transaction hook misses destination of git branch -m Maciej Ciemborowicz
2026-09-19 20:52 ` Karthik Nayak
2026-09-20 16:50 ` [PATCH] refs: run copy and rename through transactions Maciej Ciemborowicz
2026-09-21 17:54 ` Junio C Hamano
2026-09-21 23:28 ` Junio C Hamano
2026-09-22 13:08 ` Maciej Ciemborowicz
2026-09-23 13:36 ` [PATCH v2] " Maciej Ciemborowicz
2026-09-30 3:32 ` Maciej Ciemborowicz
2026-10-02 10:56 ` Patrick Steinhardt
2026-10-02 14:16 ` Maciej Ciemborowicz
2026-10-05 6:03 ` Patrick Steinhardt [this message]
2026-10-07 18:05 ` [PATCH v3 0/4] " Maciej Ciemborowicz
2026-10-07 18:05 ` [PATCH v3 1/4] refs: distinguish internal transactions from logical updates Maciej Ciemborowicz
2026-10-07 18:05 ` [PATCH v3 2/4] refs: support replacing reflogs in a transaction Maciej Ciemborowicz
2026-10-07 18:05 ` [PATCH v3 3/4] refs: run copy and rename through ordinary transactions Maciej Ciemborowicz
2026-10-07 18:05 ` [PATCH v3 4/4] refs: remove backend-specific copy and rename callbacks Maciej Ciemborowicz
2026-10-07 19:55 ` [PATCH v3 0/4] refs: run copy and rename through transactions Junio C Hamano
2026-10-08 9:44 ` [PATCH v4 " Maciej Ciemborowicz
2026-10-08 9:44 ` [PATCH v4 1/4] refs: distinguish internal transactions from logical updates Maciej Ciemborowicz
2026-10-08 9:44 ` [PATCH v4 2/4] refs: support replacing reflogs in a transaction Maciej Ciemborowicz
2026-10-08 9:44 ` [PATCH v4 3/4] refs: run copy and rename through ordinary transactions Maciej Ciemborowicz
2026-10-08 9:44 ` [PATCH v4 4/4] refs: remove backend-specific copy and rename callbacks Maciej Ciemborowicz
2026-10-08 10:10 ` [PATCH v4 0/4] refs: run copy and rename through transactions Patrick Steinhardt
2026-10-08 10:43 ` Maciej Ciemborowicz
2026-10-08 11:01 ` Maciej Ciemborowicz
2026-10-08 15:45 ` Junio C Hamano
2026-10-08 19:06 ` Maciej Ciemborowicz
2026-10-08 19:19 ` Kristoffer Haugsbakk
2026-10-08 21:11 ` Maciej Ciemborowicz
2026-10-09 5:41 ` Patrick Steinhardt
2026-10-08 15:54 ` Junio C Hamano
2026-09-23 12:49 ` [PATCH v4 0/3] refs: report old OIDs for batched deletions Maciej Ciemborowicz
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=asM9m-_ZoX_5UQ-I@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=karthik.188@gmail.com \
--cc=maciej.ciemborowicz@gmail.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