Subject: Re: [PATCH 0/2] Optionally support push options on up-to-date branches

From: Junio C Hamano <[email-masked]>
Date: Thu, 14 Mar 2024 16:29:40 -0700

"brian m. carlson" <[email-masked]> writes:

>> A radical counter-proposal for the design is to update the client
>> side to do this unconditionally, without needing any new option.
>
> I'm not sure that would be a great idea.

Thanks.  I was looking for a push-back ;-)

> Since it's a push, that will
> trigger authentication, which may prompt the user (e.g., for a password
> or token or for a YubiKey touch with FIDO2 SSH) and which they might be
> able to easily avoid.

Do you mean we first go unauthenticated to find out what commits are
at the tip of refs at the destination repository, and then switch to
authenticated push after we find out there is something that is
worth pushing?  I somehow thought we need an authenticated access
only for the initial ls-refs exchange.

> As a server operator, I also expect that there
> are people doing lots of needless attempts at pushing in automated
> systems (because with enough users, there will be at least some who do
> bizarre or inefficient things), and I would prefer to avoid serving
> those requests if I don't need to.  (For example, for us, reference
> updates need to go through a distributed commit protocol to update
> multiple replicas of the repository, and if there's no ref updates, then
> we cut out multiple services which we don't need to contact.)

Yes, but if you have an extra no-op ref update in the bunch, that
one is excluded from the set of changes to be synchronised across
replicas, no?

> Note also that no-op ref updates cannot be simply omitted on the server
> side because we need to verify that the old value for the ref is
> correct, or we need to reject the operation as out of date.

Yes, but isn't that something the user would rather want to find out
earlier rather than later?  Your push without no-op update may say
"ah, we are up to date" when we are behind or worse diverged.  If we
do the no-op update more often, we'd have more chance to catch such
a situation where the worldview the end-user's repository has is out
of sync with reality.

> I do think the proposed change is valuable, though, and I'm in favour of
> it with a suitable option.

In any case, I am OK with the feature.  I just was wondering if the
end-user experience may become simpler and easier if we did not have
to have a command line option.

Thanks.