RE: [PATCH RFC] rebase: respect --ff-only option

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

 



Alex Henrie wrote:
> The warning about pulling without specifying how to reconcile divergent
> branches says that after setting pull.rebase to true, --ff-only can
> still be passed on the command line to require a fast-forward. Make that
> actually work.

I don't see any value in doing `git rebase --ff-only`. What is the
difference with `git merge --ff-only`?

Presumably this isn't meant to to be called directly by the user, but
only by `git pull`, so it's trying to address my comment [1]:

  > You can also pass --rebase, --no-rebase, or --ff-only on the command
  > line to override the configured default per invocation.

  Can I?

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

  `--ff-only` doesn't seem to be overriding the configuration.

Passing --ff-only to `git rebase` doesn't solve the problem I was
pointing out, only half of it.

Sure, now this works:

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

But --ff-only is not really overriding anything, now you are passing the
problem along.

Consider it the other way around:

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

Is --rebase overriding anything?

No, now all these three fail:

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

This is making the situation even worse.

Junio already made the same mistake [2], and I already pointed out why
that doesn't work [3].

This is what we want:

  1. git pull # fail by default unless it's a fast-forward
  2. git pull --merge # force a merge (unless it's a fast-forward)
  3. git pull --rebase # force a rebase (unless it's a fast-forward)

If you make `git rebase` honor --ff-only, and you make --ff-only the
default, then `git pull --rebase` will *always* fail (unless it's a
fast-forward).

We want this:

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

To *ignore* pull.ff=only, not honor it.

I already explored all the options, which is why I maintain that the
only reasonable option is an orthogonal configuration:

  pull.mode=fast-forward

Cheers.

[1] https://lore.kernel.org/git/60d7faaf5311a_b8dfe208bd@natae.notmuch/
[2] https://lore.kernel.org/git/xmqqy2irjy4f.fsf@xxxxxxxxxxxxxxxxxxxxxx/
[3] https://lore.kernel.org/git/CAMP44s08mEyYqbjOeTeS46CngrbQMqP2=cMr1dtRLLk_BLAq3w@xxxxxxxxxxxxxx/

-- 
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