git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Mihail Atanassov <m.atanassov92@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] Documentation/git-bisect.txt: add --no-ff to merge command
Date: Tue, 29 Oct 2019 11:24:22 +0900	[thread overview]
Message-ID: <xmqq4kzs8f1l.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20191028222405.GE12487@google.com> (Jonathan Nieder's message of "Mon, 28 Oct 2019 15:24:05 -0700")

Jonathan Nieder <jrnieder@gmail.com> writes:

> As an orthogonal point, I wonder whether we can start the multi-step
> migration of making --no-commit imply --no-ff by default:
>
>  1. Act as --ff when --no-commit is passed without --ff or --no-ff
>     (the state today)

which means "--no-commit controls whether a new commit is created or
not and nothing else, and because --ff is the default for merge,
merging a true descendant will fast-forward".

>  5. Refuse to perform a fast-forward merge with --no-commit is passed
>     without --ff or --no-ff, just as though --no-ff were passed.

Is that a good endgame, though?  It is correct that "--no-ff" means
"do not allow the merge to be fast-forwarded and the way the option
does so is by creating an otherwise unnecessary merge commit", and
"--no-commit" means "do not allow creating any new commit", so
technically they are mutually incompatible, but would it be useful?

I'd imagine that a more useful behaviour would be for "git merge X"
with any other options to honor this basic trait: the working tree
and the index after the operation shows the result of merging X and
HEAD, if the merge can cleanly be made, and otherwise the working
tree and the index would show something close to the result of such
a merge with conflicts that would help recording the result of the
merge manually.

For that, wouldn't it make more sense ot change the semantics of the
"--no-commit" option from "no new commit gets created" to "HEAD is
not moved"?  "git merge --no-commit X" when X is a descendant of
HEAD would then become "git read-tree -m -u HEAD X" plus perhaps
storing X in .git/MERGE_HEAD file etc. to prepare for concluding
"git commit" to record the result manually.

In any case, as you said,

>>>> -if   git merge --no-commit hot-fix &&
>>>> +if   git merge --no-commit --no-ff hot-fix &&
>>>
>>> Good.
>
> This part still looks like a good change to me. :)

This looks good to me too.

  reply	other threads:[~2019-10-29  2:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 22:20 [PATCH] Documentation/git-bisect.txt: add --no-ff to merge command Mihail Atanassov
2019-10-26  2:26 ` Jonathan Nieder
     [not found]   ` <CALs020+0E=7wy-N46BRLrBcKmMSTpcMyZ9WybmgTzb60aCo5PQ@mail.gmail.com>
2019-10-28 22:10     ` Mihail Atanassov
2019-10-28 22:24       ` Jonathan Nieder
2019-10-29  2:24         ` Junio C Hamano [this message]
2019-10-29  3:25           ` Junio C Hamano

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=xmqq4kzs8f1l.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=m.atanassov92@gmail.com \
    /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).