git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Sergey Organov <sorganov@gmail.com>
To: Elijah Newren <newren@gmail.com>
Cc: "Roland Jäger" <eyenseo@mailbox.org>,
	"Junio C Hamano" <gitster@pobox.com>,
	usbuser@mailbox.org, "Git Mailing List" <git@vger.kernel.org>
Subject: Re: Unexpected or wrong ff, no-ff and ff-only behaviour
Date: Wed, 10 Jul 2019 17:36:20 +0300	[thread overview]
Message-ID: <87y316gdnf.fsf@osv.gnss.ru> (raw)
In-Reply-To: <CABPp-BHpkcOSkTrNDPGWRgSJgbqkc0PRqMqmesg7tQdS5TfMDA@mail.gmail.com> (Elijah Newren's message of "Tue, 9 Jul 2019 09:35:09 -0700")

Hi Elijah,

Elijah Newren <newren@gmail.com> writes:

> Hi Roland,
>
> On Tue, Jul 9, 2019 at 9:17 AM Roland Jäger <eyenseo@mailbox.org> wrote:
>>
>> 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

      parent reply	other threads:[~2019-07-10 14:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09  9:42 Unexpected or wrong ff, no-ff and ff-only behaviour usbuser
2019-07-09 14:51 ` Junio C Hamano
2019-07-09 16:15   ` Roland Jäger
2019-07-09 16:35     ` Elijah Newren
2019-07-09 17:00       ` usbuser
2019-07-09 20:33         ` Elijah Newren
2019-07-09 20:51           ` Bryan Turner
2019-07-10  7:49             ` usbuser
2019-07-10 16:34             ` Junio C Hamano
2019-07-11  5:13               ` Sergey Organov
2019-07-11 17:03                 ` Junio C Hamano
2019-07-12 13:50                   ` Sergey Organov
2019-07-12 16:24                     ` Elijah Newren
2019-07-15 12:08                       ` Sergey Organov
2019-07-12 18:33                     ` Junio C Hamano
2019-07-15 12:47                       ` Sergey Organov
2019-07-15 16:57                         ` Junio C Hamano
2019-07-19 11:00                           ` Sergey Organov
2019-07-11 15:46             ` brian m. carlson
2019-07-10 14:36       ` Sergey Organov [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

  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=87y316gdnf.fsf@osv.gnss.ru \
    --to=sorganov@gmail.com \
    --cc=eyenseo@mailbox.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=usbuser@mailbox.org \
    /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).