Thread (1 message) 1 message, 1 author, 2019-07-10

Re: Unexpected or wrong ff, no-ff and ff-only behaviour

From: Sergey Organov <hidden>
Date: 2019-07-10 14:46:17

Hi Elijah,

Elijah Newren [off-list ref] writes:
Hi Roland,

On Tue, Jul 9, 2019 at 9:17 AM Roland Jäger [off-list ref] wrote:
quoted
Thanks for answering Junio.

I get what git does. But I believe that either the documentation ist
wrong/ambiguous or --no-ff and --ff-only should be able to be
combined and either should be fixed - preferably the later. What I
want to say to git is "I never accept a real merge; please make a
merge commit, even if it is redundant/empty". And I believe that
github and gitlab allow to configure something like that.
Please don't top-post on this list.

I agree, the documentation is wrong or misleading and there is a
wording change we could make to improve it.  But, in particular,
--no-ff and -ff-only are completely incompatible.
They currently are compatible, but in a weird manner, see below.

I'd prefer they were perfectly compatible and orthogonal, as using both
would be the safe way to create cleanest possible merge -- the one that
introduces on the mainline the /exact/ changes made on side-branch:

--ff-only: tells git to refuse operation (actual merge) if FF is
impossible, that for this particular use-case would ensure the merge, when
actually created, is the "cleanest possible" one

and then

--no-ff: forces git to create actual (cleanest possible) merge commit,
that otherwise it wouldn't, as it defaults to --ff, and --ff-only above
ensures FF is possible.

Right now (in my git 2.10) it seems these options somehow cancel each
other, that is both useless and surprising:

When FF is possible:

$ git merge --ff-only --no-ff side_branch

Merge made by the 'recursive' strategy.
[...]

Good!

$ git reset --hard HEAD~1
[...]
$ git merge --no-ff --ff-only side_branch
Updating eafaed6..b83db07
Fast-forward    
[...]

??? I said --no-ff: how comes you did fast-forward?!

When FF is impossible:

$ git merge --ff-only --no-ff side_branch

Merge made by the 'recursive' strategy.
[...] 
??? I said --ff-only: how comes you didn't bail out?!

$ git reset --hard HEAD~1
[...]
$ git merge --no-ff --ff-only side_branch
fatal: Not possible to fast-forward, aborting.

Good!

-- Sergey

git version 2.10.0.1.g57b01a3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help