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

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

 



Jonathan Nieder <jrnieder@xxxxxxxxx> 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.



[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