git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: "Not possible to fast-forward" when pull.ff=only and new commits on remote

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 20, 2021, 19:19 UTC
Message-ID
<xmqqa6j3pkqw.fsf@gitster.g>
In-Reply-To
<YXBNY7/mWyxvAo/r@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 6 quoted lines
>> +	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.
Show 9 quoted lines
> 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.

Previous: Jeff KingNext: Jeff King
Message 5 of 9 in “"Not possible to fast-forward" when pull.ff=only and new commits on remote”
  1. Kenneth ArnoldOct 19, 2021
  2. Jeff KingOct 19, 2021
  3. Junio C HamanoOct 20, 2021
  4. Jeff KingOct 20, 2021
  5. Junio C HamanoOct 20, 2021
  6. Jeff KingOct 20, 2021
  7. pull: --ff-only should make it a noop when already-up-to-dateJunio C Hamano, Oct 20, 2021
  8. Jeff KingOct 20, 2021
  9. Alex HenrieOct 21, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.