git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Documentation/git-bisect.txt: add --no-ff to merge command

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 29, 2019, 02:24 UTC
Message-ID
<xmqq4kzs8f1l.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20191028222405.GE12487@google.com>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 5 quoted lines
> 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,
Show 6 quoted lines
>>>> -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.
Previous: Jonathan NiederNext: Junio C Hamano
Message 5 of 6 in “Documentation/git-bisect.txt: add --no-ff to merge command”
  1. Documentation/git-bisect.txt: add --no-ff to merge commandMihail Atanassov, Oct 25, 2019
  2. Jonathan NiederOct 26, 2019
  3. Mihail AtanassovOct 28, 2019
  4. Jonathan NiederOct 28, 2019
  5. Junio C HamanoOct 29, 2019
  6. Junio C HamanoOct 29, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.