Re: [PATCH v4 00/19] pull: default ff-only mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux