git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
	Matthias Baumgarten <matthias.baumgarten@aixigo.com>
Cc: Felipe Contreras <felipe.contreras@gmail.com>,
	Elijah Newren <newren@gmail.com>,
	Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>,
	Git Mailing List <git@vger.kernel.org>,
	Alex Henrie <alexhenrie24@gmail.com>,
	Phillip Wood <phillip.wood123@gmail.com>,
	Son Luong Ngoc <sluongng@gmail.com>
Subject: Re: When are you going to stop ignoring pull.mode?
Date: Sat, 17 Jul 2021 16:59:24 -0500	[thread overview]
Message-ID: <60f352bce4d53_554620882@natae.notmuch> (raw)
In-Reply-To: <xmqqwnpooctj.fsf@gitster.g>

Junio C Hamano wrote:
> Matthias Baumgarten <matthias.baumgarten@aixigo.com> writes:
> 
> >>>     pull.ff  pull.rebase  commandline            action
> >>> ...
> >>>       *          *        --ff-only              fast-forward only[1]
> >>> ...
> > What about
> >
> >          *       !false      --ff-only              ???
> 
> This is covered by an earlier entry ("*" stands for "any value"), I
> think; it should fast-forward or fail.  The reasoning goes like
> this:
> 
> The user configures pull.rebase to some kind of rebase; it could be
> just true (the traditional flattening rebase), or the one that
> preserves the shape of the history, or even the interactive one.
> With the configuration, what the user declares is: 
> 
>     I may have my own development on top of the result of my last
>     integration with the upstream I did when I ran "git pull" the
>     last time, and when the upstream has more commits, the way I
>     want my local work to integrate with their work is to replay my
>     work on top of theirs (as opposed to "merging their work into my
>     history").
> 
> But by passing "--ff-only" from the command line, the user tells us
> this:
> 
>     This time only, I want fast-forward update and nothing else.  I
>     do not remember doing any of my own development on top of their
>     history, and I expect that this update from the upstream would
>     fast-forward.  If that is not the case, please error out, as I
>     need to inspect the situation further and I do not want to see
>     conflicts in unexpected commits I thought I did not have.

No, this is what you think the user would be telling us, but that's not
what the user is *actually* telling us right now.

  git -c pull.ff=only pull --rebase

What the user is actually telling us right now is that while he normally
would expect a fast-forward, in this case he would like a rebase.

Today this is the equivalent of:

  git -c pull.rebase=true pull --ff-only

If you change this interpretation, it would break the symmetry between
configurations and command line arguments.

> So the "action" would be
> 
>  - If their history is a descendant of ours, that means that on top
>    of their history previously observed by us, we haven't added any
>    development of our own.  We just move to the tip of their history
>    and we are done.
> 
>    This is not so surprising anyway.  If we are doing any kind of
>    rebasing, what happens is to start from the tip of their history
>    and then commits from our own development are replayed on top of
>    that.  When their history is a descendant of ours, we end up
>    doing just fast-forward, as there is nothing to replay on top.

But --ff-only is not for rebases, the documentation is very clear:

	Specifies how a merge is handled when the merged-in history is
	already a descendant of the current history.  `--ff` is the
	default unless merging an annotated (and possibly signed) tag
	that is not stored in its natural place in the `refs/tags/`
	hierarchy, in which case `--no-ff` is assumed.

  With `--ff-only`, resolve the merge as a fast-forward when possible.
  When not possible, refuse to merge and exit with a non-zero status.

>  - Otherwise, because the user expects the command to fail if their
>    history is not a descendant of ours, we fail.
> 
> And "fast-forward only" in Elijah's table is a concise way to say
> that.

Yes, but it's taking us in the wrong direction by ignoring how the users
actually use --ff-only today, what the documentation actually says,
breaking the symmetry of configurations and arguments, and making
everything less intuitive.


On the other hand if --ff-only was mapped to pull.mode=fast-forward
instead, everything is clear:

  git -c pull.mode=fast-forward pull --rebase
  git -c pull.mode=rebase pull --ff-only

I don't even need to explain what these do.

-- 
Felipe Contreras

  reply	other threads:[~2021-07-17 21:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16 19:14 When are you going to stop ignoring pull.mode? Felipe Contreras
2021-07-17  2:14 ` Bagas Sanjaya
2021-07-17 17:53   ` Felipe Contreras
2021-07-17 10:22 ` Matthias Baumgarten
2021-07-17 17:57   ` Felipe Contreras
2021-07-17 21:22   ` Junio C Hamano
2021-07-17 21:59     ` Felipe Contreras [this message]
2021-07-19 14:14     ` Matthias Baumgarten
2021-07-19 16:54       ` Junio C Hamano
2021-07-19 17:15       ` Felipe Contreras

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60f352bce4d53_554620882@natae.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=alexhenrie24@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=matthias.baumgarten@aixigo.com \
    --cc=newren@gmail.com \
    --cc=phillip.wood123@gmail.com \
    --cc=sluongng@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).