git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Git <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Cc: Elijah Newren <newren@gmail.com>,
	Alex Henrie <alexhenrie24@gmail.com>, Jeff King <peff@peff.net>,
	Philip Oakley <philipoakley@iee.email>
Subject: Re: [PATCH v4 00/19] pull: default ff-only mode
Date: Mon, 7 Dec 2020 18:57:32 -0600	[thread overview]
Message-ID: <CAMP44s2hUCd9qc83LReGyjy8N+u++eK6VjwGhDhrX0f0SbKmig@mail.gmail.com> (raw)
In-Reply-To: <20201208002648.1370414-1-felipe.contreras@gmail.com>

Hi,

Junio, this is intended for you, I will describe step by step how the
warning evolves.

Step 0: This is what we have today:

  Pulling without specifying how to reconcile divergent branches is
  discouraged. You can squelch this message by running one of the following
  commands sometime before your next pull:

    git config pull.rebase false  # merge (the default strategy)
    git config pull.rebase true   # rebase
    git config pull.ff only       # fast-forward only

  You can replace "git config" with "git config --global" to set a default
  preference for all repositories. You can also pass --rebase, --no-rebase,
  or --ff-only on the command line to override the configured default per
  invocation.

> Felipe Contreras (19):
>   doc: pull: explain what is a fast-forward
>   pull: improve default warning

Step 1: This is low-hanging fruit that can be fixed today without any
change in behavior:

  Pulling without specifying how to reconcile divergent branches is discouraged;
  you need to specify if you want a merge, or a rebase.
  You can squelch this message by running one of the following commands:

    git config pull.rebase false  # merge (the default strategy)
    git config pull.rebase true   # rebase
    git config pull.ff only       # fast-forward only

  You can replace "git config" with "git config --global" to set a default
  preference for all repositories.
  If unsure, run "git pull --no-rebase".
  Read "git pull --help" for more information.

>   pull: refactor fast-forward check
>   pull: cleanup autostash check
>   pull: trivial cleanup
>   pull: move default warning
>   pull: display default warning only when non-ff

At this point we can update the warning to mention that we are inside
a non-fast-forward case. But it's not necessary.

>   pull: trivial whitespace style fix
>   pull: introduce --merge option

s/--no-rebase/--merge/

>   pull: show warning with --ff
>   rebase: add REBASE_DEFAULT
>   pull: move configurations fetches
>   test: merge-pull-config: trivial cleanup
>   test: pull-options: revert unnecessary changes
>   pull: trivial memory fix

This is the end of part I. At this point the default mode is still
"merge", and the only behavior change is that the warning is printed
only on the non-fast-forward case.

========================================================================

>   pull: add pull.mode

Step 2: pull.mode={merge,rebase} are specified

  Pulling without specifying how to reconcile divergent branches is discouraged;
  you need to specify if you want a merge, or a rebase.
  You can squelch this message by running one of the following commands:

    git config pull.mode merge    # (the default strategy)
    git config pull.mode rebase
    git config pull.ff only       # fast-forward only

  You can replace "git config" with "git config --global" to set a default
  preference for all repositories.
  If unsure, run "git pull --merge".
  Read "git pull --help" for more information.

>   pull: add pull.mode=ff-only

Step 3: Now pull.mode=ff-only

  Pulling without specifying how to reconcile divergent branches is discouraged;
  you need to specify if you want a merge, or a rebase.
  You can squelch this message by running one of the following commands:

    git config pull.mode merge    # (the default strategy)
    git config pull.mode rebase
    git config pull.mode ff-only  # fast-forward only

  You can replace "git config" with "git config --global" to set a default
  preference for all repositories.
  If unsure, run "git pull --merge".
  Read "git pull --help" for more information.

However, now in addition to the warning, there's an error message:

  The pull was not fast-forward, please either merge or rebase.

This error message is *only* triggered when the user has manually
configured "pull.mode=ff-only". And it is an error. The program dies.

And it's not meant to be temporary; it's permanent behavior.

>   pull: advice of future changes

Step 4: Now that pull.mode=ff-only is in place, we can aim for it
being the default, and we can tell our users that it will be the
default in the future.

  The pull was not fast-forward, in the future you will have to choose
a merge, or a rebase.

  To quell this message you have two main options:

  1. Adopt the new behavior:

    git config --global pull.mode ff-only

  2. Maintain the current behavior:

    git config --global pull.mode merge

  For now we will fall back to the traditional behavior (merge).
  Read "git pull --help" for more information.

This is the end of part II. At this point the default is still "merge".

Unlike part I, in part II we have committed to pull.mode=ff-only to be
the new default, and we are already telling users that they can use
this new mode to test the new behavior.

We should probably stay a couple of releases at this point, with this
warning, and the new behavior already configurable.

Elijah: notice how there's no mention of `git pull --merge`, because
in my opinion now we are telling users this is a temporary *warning*,
and the way to get rid of it properly should be very clear.

========================================================================

>   future: pull: enable ff-only mode by default

The last patch finally enables the ff-only mode by default, and the
warning is removed forever.

The only thing that remains now is the fatal error:

  The pull was not fast-forward, please either merge or rebase.

This fatal error is avoided by pull.mode=merge, pull.mode=rebase,
pull.rebase=true, pull.rebase=false, pull.rebase=$other, --merge, or
--rebase.

It *only* happens when the user does a vanilla "git pull", it's a
non-fast-forward update, the user has configured pull.mode=ff-only or
has not configured any of the above.

Is it more clear what is my proposal?

Cheers.

-- 
Felipe Contreras

      parent reply	other threads:[~2020-12-08  0:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08  0:26 [PATCH v4 00/19] pull: default ff-only mode Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 01/19] doc: pull: explain what is a fast-forward Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 02/19] pull: improve default warning Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 03/19] pull: refactor fast-forward check Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 04/19] pull: cleanup autostash check Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 05/19] pull: trivial cleanup Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 06/19] pull: move default warning Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 07/19] pull: display default warning only when non-ff Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 08/19] pull: trivial whitespace style fix Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 09/19] pull: introduce --merge option Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 10/19] pull: show warning with --ff Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 11/19] rebase: add REBASE_DEFAULT Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 12/19] pull: move configurations fetches Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 13/19] test: merge-pull-config: trivial cleanup Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 14/19] test: pull-options: revert unnecessary changes Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 15/19] pull: trivial memory fix Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 16/19] pull: add pull.mode Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 17/19] pull: add pull.mode=ff-only Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 18/19] pull: advice of future changes Felipe Contreras
2020-12-08  0:26 ` [PATCH v4 19/19] future: pull: enable ff-only mode by default Felipe Contreras
2020-12-08  0:57 ` Felipe Contreras [this message]

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=CAMP44s2hUCd9qc83LReGyjy8N+u++eK6VjwGhDhrX0f0SbKmig@mail.gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=alexhenrie24@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=philipoakley@iee.email \
    /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).