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

Re: [PATCH 3/5] pull: handle conflicting rebase/merge options via last option wins

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 16, 2021, 21:18 UTC
Message-ID
<xmqqwnpqot4m.fsf@gitster.g>
In-Reply-To
<CABPp-BEHNpfm6mJBDZ30wCEraT03p+2-gGZyZcnUV34trAzAzw@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 6 quoted lines
> the dozen+ recent messages in the various recent threads, I think I've
> figured out your opinion in all but two cases, but I have no idea your
> intent on those two (I would have thought --rebase override there too,
> but you excluded that), and I'm rather uncertain I've correctly
> understood you for the other ones (I really hope gmail doesn't
> whitespace damage the following table):
Yeah, it's about time somebody made an exhaustive table of cases ;-)

I appreciate it very much. Without such a table, it is hard to have discussion and keep track of which part is and which part is not what people agree to.

Below, I rearranged some rows to group cases I think belong together to make commenting on them easier, but I didn't remove or add any rows.

>    pull.ff  pull.rebase  commandline            action
>      *          *        --ff-only --rebase     fast-forward only[1]
>      *          *        --ff-only --no-rebase  fast-forward only
>      *          *        --ff-only              fast-forward only[1]

I think these three make sense. As you answered to a question in another thread, I agree that --ff-only from the command line should fail instead of letting rebase (or merge for that matter) go ahead when their history is not a descendant of ours and it is a bug if it does not.

>      *          *        --rebase --no-ff       rebase[1]
>      *          *        --rebase --ff          rebase[1]
OK.
>      *          *        --no-rebase --no-ff    merge --no-ff
>      *          *        --no-rebase --ff       merge --ff
OK.
>     <unset>     *        --no-rebase            merge --ff
>     only        *        --no-rebase            merge --ff[2]
>     false       *        --no-rebase            merge --no-ff
>     true        *        --no-rebase            merge --ff

I think the second one deserves an explanation. The rationale for ignoring --ff-only is because the act of giving an explicit "--rebase" or "--no-rebase" from the command line, when the configured default is "I expect to have no development on my own here, and only want to follow along", is a sign enough that the user does not want to follow along in this particular invocation of "pull". And the rationale for the entire thing to become --ff is only because between --ff and --no-ff, the former is the default.

About the second one, I would understand it if it became "merge --ff-only", too. That is more trivially explained. I however suspect that it would be less useful, but that is open to discussion.

All three others I think are not controversial.
>     <unset>     *        --rebase               rebase
>     only        *        --rebase               rebase[2]
>     false       *        --rebase               ?[2]
>     true        *        --rebase               ?[2]

Again the same reasoning applies to the second case that defeats the configured pull.ff=only setting. pull.ff=unset and pull.ff=true would be handled the same, so only the pull.ff=false might deserve an explanation. I not think there needs anything special, as there is no "I want to do something special to mark the fact that we tried to integrate their work" special case needed even when their history is descendant of ours in "rebase" workflow, where we replay what we did on top of theirs (in other words, in "merge" workflow, the shape of history left with --no-ff would be different from --ff; in "rebase", there is no difference---either you had your own development before you ran "pull --rebase" and they got replayed on top of their history, or you had nothing before you ran "pull --rebase" and you did your development after that on top of their history, you'd end up with histories of the same shape. This would not happen with "merge" workflow and that is why --no-ff may matter).

So, I agree with the above 4 (and the other 4 for --no-rebase) entries.

>      *       <unset>     --no-ff                merge --no-ff
>      *        false      --no-ff                merge --no-ff
>      *       <unset>     --ff                   merge --ff
>      *        false      --ff                   merge --ff
OK.
>      *       !false      --no-ff                rebase (ignore --no-ff)[2][3]
>      *       !false      --ff                   rebase (ignore --ff)[2][3]
OK.  We do specified rebase, allowing fast-forward.

pull.rebase=<something> combined with --no-ff could mean "I do expect I have some development of my own, and please stop me if I don't" and instead of rebasing nothing, error out without even repointing our branch tip to their history when it fast forwards, but I suspect that it would be less useful. Again, that (and anything else I said here) is open to discussion.

Show 7 quoted lines
> It appears you, Phillip, and I all had different opinions about
> correct behavior and in a few cases though the documentation clearly
> implied what we thought.  So, I'd have to say the documentation is
> rather unclear as well.  However, even if the above table is filled
> out, it may be complicated enough that I'm at a bit of a loss about
> how to update the documentation to explain it short of including the
> table in the documentation.
Thanks.
Previous: Elijah NewrenNext: Felipe Contreras
Message 14 of 26 in “Handle conflicting pull options”
  1. 0/5 Handle conflicting pull optionsElijah Newren via GitGitGadget, Jul 15, 2021
  2. 1/5 pull: move definitions of parse_config_rebase and parse_opt_rebaseElijah Newren via GitGitGadget, Jul 15, 2021
  3. 3/5 pull: handle conflicting rebase/merge options via last option winsElijah Newren via GitGitGadget, Jul 15, 2021
  4. Eric SunshineJul 15, 2021
  5. Elijah NewrenJul 15, 2021
  6. Felipe ContrerasJul 15, 2021
  7. Junio C HamanoJul 15, 2021
  8. Felipe ContrerasJul 15, 2021
  9. Elijah NewrenJul 15, 2021
  10. Junio C HamanoJul 15, 2021
  11. Elijah NewrenJul 15, 2021
  12. Junio C HamanoJul 15, 2021
  13. Elijah NewrenJul 16, 2021
  14. Junio C HamanoJul 16, 2021
  15. Felipe ContrerasJul 16, 2021
  16. Junio C HamanoJul 15, 2021
  17. Elijah NewrenJul 15, 2021
  18. 2/5 pull: convert OPT_PASSTHRU for fast-forward options to OPT_CALLBACKElijah Newren via GitGitGadget, Jul 15, 2021
  19. 4/5 pull: abort if --ff-only is given and fast-forwarding is impossibleAlex Henrie via GitGitGadget, Jul 15, 2021
  20. 5/5 pull: abort by default when fast-forwarding is not possibleElijah Newren via GitGitGadget, Jul 15, 2021
  21. Eric SunshineJul 15, 2021
  22. Elijah NewrenJul 15, 2021
  23. Felipe ContrerasJul 15, 2021
  24. Ævar Arnfjörð BjarmasonJul 16, 2021
  25. Felipe ContrerasJul 16, 2021
  26. Felipe ContrerasJul 15, 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.