From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Kenneth Arnold <ka37@calvin.edu>,
Alex Henrie <alexhenrie24@gmail.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: "Not possible to fast-forward" when pull.ff=only and new commits on remote
Date: Wed, 20 Oct 2021 12:19:19 -0700 [thread overview]
Message-ID: <xmqqa6j3pkqw.fsf@gitster.g> (raw)
In-Reply-To: <YXBNY7/mWyxvAo/r@coredump.intra.peff.net> (Jeff King's message of "Wed, 20 Oct 2021 13:09:55 -0400")
Jeff King <peff@peff.net> writes:
>> + ours = lookup_commit_reference(the_repository, orig_head);
>
> I think orig_head can be the null oid if we're on an unborn HEAD. I
> guess you'd want to return "1" in that case (but I could be wrong; it
> looks like get_can_ff() assumes it's valid, so perhaps that case is
> handled earlier).
It is a good point; the main codeflow already special cases the
unborn HEAD to delegate to pull_into_void() before it gets to the
point to call get_can_ff().
> I'd expect that merge_heads can never be empty here, or we'd bail
> earlier in the command
Yes, that happens even before that "are we unborn" check.
> Running a sequence of traversals like this can be slow, because we may
> walk over the same history again and again. But I think in the usual
> non-octopus cases we'd only have one entry, so we'd only be adding a
> single extra merge-base traversal in most cases.
>
> It does feel like this could be combined with get_can_ff() somehow so
> that we're not adding even that single traversal. But I expect that may
> be hard to do because of the multiple heads (e.g., we cannot use the
> usual ahead/behind code).
I'd leave such an optimization as a separate topic. This was meant
to be a regression fix.
next prev parent reply other threads:[~2021-10-20 19:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 17:23 "Not possible to fast-forward" when pull.ff=only and new commits on remote Kenneth Arnold
2021-10-19 21:22 ` Jeff King
2021-10-20 16:28 ` Junio C Hamano
2021-10-20 17:09 ` Jeff King
2021-10-20 19:19 ` Junio C Hamano [this message]
2021-10-20 20:36 ` Jeff King
2021-10-20 19:02 ` [PATCH v2] pull: --ff-only should make it a noop when already-up-to-date Junio C Hamano
2021-10-20 20:45 ` Jeff King
2021-10-21 6:38 ` Alex Henrie
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=xmqqa6j3pkqw.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=alexhenrie24@gmail.com \
--cc=git@vger.kernel.org \
--cc=ka37@calvin.edu \
--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).