From: Junio C Hamano <gitster@pobox.com>
To: Tom Hughes <tom@compton.nu>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2] push: don't fetch commit object when checking existence
Date: Wed, 22 May 2024 14:58:19 -0700 [thread overview]
Message-ID: <xmqqbk4x1pc4.fsf@gitster.g> (raw)
In-Reply-To: <8f2ebf1b-050f-476a-92d4-dfb06ad04f8d@compton.nu> (Tom Hughes's message of "Wed, 22 May 2024 22:46:16 +0100")
Tom Hughes <tom@compton.nu> writes:
>>> + test_must_fail git -C client push 2>err &&
>> We try to overwrite it. We expect it to fail with "not a fast
>> forward".
>
> Well that is what it would fail with at the moment, but it's not
> what would happen with a non-partial clone - a non-partial clone
> would fail with "fetch first" instead.
Oh, don't get me wrong. I wasn't trying to split hairs between the
two error modes and their phrasing. The "fetch-first" from
set_ref_status_for_push() is done before we even initiate the
transfer to stop the operation, with a cheap check, that will
eventually lead to "not a fast forward" error. IOW, in my mind,
they are the same errors, just diagnosed at two different places in
the code and their messages phrased differently.
> So here we are testing that it's a "fetch first" and rather
> than "not a fast forward".
I think that is being overly specific, but that is fine. As I said,
to the end users, these two errors mean the same thing (they would
need to fetch first and then integrate their changes before pushing
it out again), so it is plausible that we may in the future decide
that we want to use the same message. When it happens, this test
must change, which may even be a good thing (it makes it clear what
the fallout from such a change looks like).
>>> + git -C client rev-list --objects --missing=print "$COMMIT" >objects &&
>>> + grep "^[?]$COMMIT" objects
>>> +'
>> OK.
>
> and also that it hasn't fetched the new commit.
Yes, and this is a good check that will stand the test of time, even
across a change to rephrase the error message.
Thanks.
next prev parent reply other threads:[~2024-05-22 21:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-22 13:36 [PATCH] push: don't fetch commit object when checking existence Tom Hughes
2024-05-22 19:16 ` Junio C Hamano
2024-05-22 20:15 ` [PATCH v2] " Tom Hughes
2024-05-22 20:55 ` Junio C Hamano
2024-05-22 21:46 ` Tom Hughes
2024-05-22 21:58 ` Junio C Hamano [this message]
2024-05-23 8:58 ` Jeff King
2024-05-22 20:18 ` [PATCH] " Tom Hughes
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=xmqqbk4x1pc4.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=tom@compton.nu \
/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).