From: Junio C Hamano <gitster@pobox.com>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org, ps@pks.im, jltobler@gmail.com,
kristofferhaugsbakk@fastmail.com,
Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH v5 3/3] hook: introduce the receive-report hook
Date: Wed, 02 Sep 2026 12:14:34 -0700 [thread overview]
Message-ID: <xmqqik4nihyd.fsf@gitster.g> (raw)
In-Reply-To: <CAOLa=ZTfPq3r3b7EDOSrG0-uSFQGgu-k3agPJgUV9xao8WsQrw@mail.gmail.com> (Karthik Nayak's message of "Wed, 2 Sep 2026 07:42:19 -0700")
Karthik Nayak <karthik.188@gmail.com> writes:
>> In any case, if the actual ref updates and the reported ref updates
>> result can be made different, somebody then needs to step in and
>> reconcile the inconsistencies, no?
>
> Naturally, the server is in charge of that, this is similar with the
> pre-receive or proc-receive hooks. In that aspects this is very similar
> to the proc-receive hook which transfers the responsibility of updating
> refs to the owner of the hook.
I am afraid that my point probably did not come across clearly.
I am talking about the repository on the user's local workstation
from which 'git push' was run. The server reported that the push
failed, so the remote-tracking branches in the local repository
reflect that the push did not succeed. In reality, however, the ref
transaction was already committed on the server. When the user runs
'git fetch' after the failed 'git push' returns, they may see that
the server actually accepted the update. The server cannot be "in
charge" of that, as it is incapable of resolving this discrepancy.
Only the user, by choosing to fetch again, can reconcile local state
with the server.
>> The way pusher perceives the state of their remote repository they
>> just pushed to, which they learn from the output of receive-report
>> hook, would have no link to reality when this hook is used on the
>> remote side. This may matter because the "git push" updates its own
>> remote-tracking branches to match what the remote says (i.e.,
>> pretends as if "git push" was immediately followed by "git fetch" to
>> the same remote).
>
> For remote tracking, that's exactly the conservative behavior we want
> from the hook. When the hook reports 'ng', the client does not update
> the reference to a new value, meaning the push did not happen and that
> is what we want to convey.
But still the server side did already commit the ref transaction so
the update has been made. Here is how the proposed commit log
message explained this:
>>> Note that in either failure mode, ref updates already applied by
>>> execute_commands() are not rolled back. The hook can cause the client
>>> to perceive the push as failed, but cannot undo server-side changes.
prev parent reply other threads:[~2026-09-02 19:14 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 7:55 [PATCH] hook: introduce the report hook for git-receive-pack(1) Karthik Nayak
2026-08-18 20:54 ` Junio C Hamano
2026-08-19 7:03 ` Kristoffer Haugsbakk
2026-08-19 12:11 ` Karthik Nayak
2026-08-19 14:47 ` Kristoffer Haugsbakk
2026-08-19 7:39 ` Patrick Steinhardt
2026-08-19 13:13 ` Karthik Nayak
2026-08-19 13:20 ` Patrick Steinhardt
2026-08-19 13:24 ` Karthik Nayak
2026-08-20 9:50 ` Phillip Wood
2026-08-20 15:43 ` Junio C Hamano
2026-08-21 12:51 ` Karthik Nayak
2026-08-21 13:34 ` [PATCH v2] " Karthik Nayak
2026-08-21 13:49 ` Patrick Steinhardt
2026-08-21 16:08 ` Karthik Nayak
2026-08-24 5:32 ` Patrick Steinhardt
2026-08-24 8:14 ` Karthik Nayak
2026-08-21 16:55 ` Junio C Hamano
2026-08-24 10:20 ` [PATCH v3 0/3] " Karthik Nayak
2026-08-24 10:20 ` [PATCH v3 1/3] doc: add proc-receive hook info in 'git-receive-pack.adoc' Karthik Nayak
2026-08-24 10:21 ` [PATCH v3 2/3] receive-pack: move message generation to separate function Karthik Nayak
2026-08-24 10:21 ` [PATCH v3 3/3] hook: introduce the report hook for git-receive-pack(1) Karthik Nayak
2026-08-24 15:35 ` [PATCH v3 0/3] " Junio C Hamano
2026-08-24 15:57 ` Junio C Hamano
2026-08-24 17:00 ` Patrick Steinhardt
2026-08-26 8:35 ` Karthik Nayak
2026-08-26 14:39 ` Junio C Hamano
2026-08-26 10:19 ` [PATCH v4 0/3] hook: introduce the receive-report hook Karthik Nayak
2026-08-26 10:19 ` [PATCH v4 1/3] doc: add proc-receive hook info in 'git-receive-pack.adoc' Karthik Nayak
2026-08-31 6:44 ` Patrick Steinhardt
2026-08-31 18:22 ` Karthik Nayak
2026-08-26 10:19 ` [PATCH v4 2/3] receive-pack: move message generation to separate function Karthik Nayak
2026-08-31 6:44 ` Patrick Steinhardt
2026-08-31 19:05 ` Karthik Nayak
2026-08-26 10:19 ` [PATCH v4 3/3] hook: introduce the receive-report hook Karthik Nayak
2026-08-31 6:45 ` Patrick Steinhardt
2026-09-01 15:19 ` [PATCH v5 0/3] " Karthik Nayak
2026-09-01 15:19 ` [PATCH v5 1/3] doc: add proc-receive hook info in 'git-receive-pack.adoc' Karthik Nayak
2026-09-01 15:19 ` [PATCH v5 2/3] receive-pack: move message generation to separate function Karthik Nayak
2026-09-01 16:23 ` Junio C Hamano
2026-09-02 11:23 ` Karthik Nayak
2026-09-01 15:19 ` [PATCH v5 3/3] hook: introduce the receive-report hook Karthik Nayak
2026-09-01 17:03 ` Junio C Hamano
2026-09-02 14:42 ` Karthik Nayak
2026-09-02 19:14 ` Junio C Hamano [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=xmqqik4nihyd.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jltobler@gmail.com \
--cc=karthik.188@gmail.com \
--cc=kristofferhaugsbakk@fastmail.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=ps@pks.im \
/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.