From: Miklos Vajna <vmiklos@suse.cz>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] merge: allow using --no-ff and --ff-only at the same time
Date: Mon, 1 Jul 2013 17:27:30 +0200 [thread overview]
Message-ID: <20130701152730.GH17269@suse.cz> (raw)
In-Reply-To: <51D197AD.1070502@alum.mit.edu>
[-- Attachment #1: Type: text/plain, Size: 3046 bytes --]
Hi Michael,
On Mon, Jul 01, 2013 at 04:52:29PM +0200, Michael Haggerty <mhagger@alum.mit.edu> wrote:
> On 07/01/2013 09:01 AM, Miklos Vajna wrote:
> > 1347483 (Teach 'git merge' and 'git pull' the option --ff-only,
> > 2009-10-29) says this is not allowed, as they contradict each other.
> >
> > However, --ff-only is about asserting the input of the merge, and
> > --no-ff is about instructing merge to always create a merge commit, i.e.
> > it makes sense to use these options together in some workflow, e.g. when
> > branches are integrated by rebasing then merging, and the maintainer
> > wants to be sure the branch is rebased.
>
> That is one interpretation of what these options should mean, and I
> agree that it is one way of reading the manpage (which says
>
> --ff-only::
> Refuse to merge and exit with a non-zero status unless the
> current `HEAD` is already up-to-date or the merge can be
> resolved as a fast-forward.
>
> ). However, I don't think that the manpage unambiguously demands this
> interpretation, and that (more importantly) most users would be very
> surprised if --ff-only and --no-ff were not opposites.
Yes, I agree that that's an unfortunate naming. --ff and --no-ff is the
opposite of each other, however --ff-only is independent, and I would
even rename it to something like --ff-input-only -- but I don't think
it's worth to do so, seeing the cost of it (probably these options are
used by scripts as well).
> How does it hurt? If I have configuration value merge.ff set to "only"
> and run "git merge --no-ff" and then I merge a branch that *cannot* be
> fast forwarded, the logic of your patch would require the merge to be
> rejected, no? But I think it is more plausible to expect that the
> command line option takes precedence.
Hmm, I did not remember that actually merge.ff even uses the same
configuration slot for these switches. :-( Yes, that would make sense to
fix, once the switches can be combined. Maybe merge.ff and
merge.ff-only?
> In my opinion, your use case shouldn't be supported by the command
> because (1) it is confusing,
I don't see why it would be confusing. I think using these two options
together is one way to try to get the benefits of both rebase (cleaner
history) and merge (keeping the history of which commits came from a
given merge).
> (2) it is not very common,
Hard to argue that argument. :-) No idea what counts as common, my
motivation is that some projects (e.g. syslog-ng) integrate *every*
feature branch this way, and doing this "manually" (as in indeed
manually or by using a helper script) seems suboptimal, when the support
for this is already mostly in merge.c, just disabled.
> easy to work around:
>
> if git merge-base --is-ancestor HEAD $branch
> then
> git merge --no-ff $branch
> else
> echo "fatal: Not possible to fast-forward, aborting."
> exit 1
> fi
Right, that's indeed a viable workaround for the problem.
Miklos
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2013-07-01 15:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-01 7:01 [PATCH] merge: allow using --no-ff and --ff-only at the same time Miklos Vajna
2013-07-01 14:52 ` Michael Haggerty
2013-07-01 15:27 ` Miklos Vajna [this message]
2013-07-01 15:38 ` Junio C Hamano
2013-07-01 16:10 ` Miklos Vajna
2013-07-01 16:43 ` Junio C Hamano
2013-07-01 19:54 ` [PATCH] merge: handle --ff/--no-ff/--ff-only as a tri-state option Miklos Vajna
2013-07-01 20:27 ` Junio C Hamano
2013-07-02 8:42 ` Michael Haggerty
2013-07-02 14:47 ` [PATCH v2] " Miklos Vajna
2013-07-02 20:12 ` Junio C Hamano
2013-07-02 18:46 ` [PATCH] " 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
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=20130701152730.GH17269@suse.cz \
--to=vmiklos@suse.cz \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mhagger@alum.mit.edu \
/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).