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

Re: [RFC 2/2] pull: default pull.ff to "only" when pull.rebase is not set either

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 3, 2020, 18:06 UTC
Message-ID
<xmqq7dpyix1d.fsf@gitster.c.googlers.com>
In-Reply-To
<CAMP44s1Hwun+P=j5BBbVUT-ACS4hJCyRCJT-=6WvwK913fXq7g@mail.gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
> In other words: --rebase should disable the --ff-only mode.
>
> Also, we would want --no-rebase to disable the default --ff-only mode.

Yes, and for that a configured pull.rebase counts the same as a command line option. As you agreed earlier in the part omitted from the quote with my "I would have expected...", we want to say:

    There are two ways to consolidate your own work with the history
    of the other side, that gives a result in vastly different
    shapes that suit for different workflows, and "git pull" will
    not choose between them for you.  Unless you say which one
    between rebase and merge you want to use, it will work only for
    fast-forward updating from the other side and nothing else.

and the "default to --ff-only when the user does not say" is a means to do so. When the end-user gives an explicit preference between the merge/rebase, none of the above would apply.

> That would require changing the semantics of --ff-only, so that "git
> pull --no-rebase --ff-only" doesn't make sense (as --ff-only is
> overridden by --no-rebase).

I do not think such a conclusion follows from "we do not want to use the 'by default force the --ff-only' when the user chooses between merge and rebase". Specifically, I do not agree with "as --ff-only is overridden" in your statement.

When the end user says "git pull --no-rebase --ff-only", it means to me:

    I choose not to use rebase---my preference is to merge in the
    other history into mine, and I want to reject any non-fast
    update in this invocation.

and I find it quite sensible, especially in a modern world where you practically must set pull.rebase to one way or the other. A developer X, an individual contributor to the project who uses rebase most of the time, may use "git pull --no-rebase" from somebody else's repository (i.e. not X's "upstream") when a help is offered by another developer Y who forked from X to advance X's work. If the upstream project does not want to see merge commits in a side branch (i.e. the history X offers to the project), X may ask Y to make sure Y builds on top of the whole of X's work, and adding "--ff-only" to the command line would be a way to make sure the result is fast-forward.

Show 6 quoted lines
> If we do this, then the only time where --ff-only would make sense is
> in "git pull --ff-only" (no --rebase or --no-rebase), and if we change
> the semantics this way, then there's no need for my suggested
> pull.mode (although it still might be desired).
>
> Moreover, I see no tests that check for this new behavior.

A proposal to change behaviour needs to come with tests to protect new behaviour before we can merge, but we should be more lenient on a patch with RFC label on it ;-).

Apparently the patch had me say "I am not seeing what problem this tries to solve, exactly", and a test may have helped to demonstrate the intention of the change better, even in its RFC state.

Previous: Felipe ContrerasNext: Junio C Hamano
Message 9 of 18 in “[RFC 1/2] pull: warn that pulling will not merge by default in Git 3.0”
  1. Alex HenrieNov 25, 2020
  2. 2/2 pull: default pull.ff to "only" when pull.rebase is not set eitherAlex Henrie, Nov 25, 2020
  3. Felipe ContrerasNov 25, 2020
  4. Felipe ContrerasNov 25, 2020
  5. Philip OakleyNov 25, 2020
  6. Felipe ContrerasDec 2, 2020
  7. Junio C HamanoDec 3, 2020
  8. Felipe ContrerasDec 3, 2020
  9. Junio C HamanoDec 3, 2020
  10. Junio C HamanoDec 3, 2020
  11. Felipe ContrerasDec 3, 2020
  12. Jacob KellerDec 4, 2020
  13. Junio C HamanoDec 4, 2020
  14. Felipe ContrerasDec 4, 2020
  15. Junio C HamanoDec 4, 2020
  16. Felipe ContrerasDec 4, 2020
  17. Alex HenrieDec 11, 2020
  18. Felipe ContrerasDec 12, 2020

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.