From: Junio C Hamano <gitster@pobox.com>
To: Yuval Kogman <nothingmuch@woobling.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Add --ff-only flag to git-merge
Date: Thu, 29 Jan 2009 14:29:05 -0800 [thread overview]
Message-ID: <7vbptpeoge.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <a891e1bd0901291257t774af061s84497cde8f4bf61c@mail.gmail.com> (Yuval Kogman's message of "Thu, 29 Jan 2009 22:57:43 +0200")
Yuval Kogman <nothingmuch@woobling.org> writes:
> I started incorperating your feedback but before I send a new patch I
> have several questions about the trickier bits:
>
> 2009/1/28 Junio C Hamano <gitster@pobox.com>:
>
>> * The placement of this misses the case where a merge of two unrelated
>> histories is attempted. You would need to also have a check at "No
>> common ancestors found. We need a real merge." part.
>
> Won't that fall through? The if (!common) is above, and this is
> eventually an else if for it (see line 978)
When "if (!common)" is true, the empty statement ";" is executed, and all
its "else if" conditional arms will be skipped. Is that what you want to
happen?
>> The octopus
>> codepath could also end up with a fast forward or up-to-date.
>
> So this case is obviously more convoluted... If an octopus merge is
> chosen should it just pass --ff-only to git-merge-octopus? Or maybe it
> should always pass --ff-only and the various different strategies
> would just die unconditionally?
I was referring to this part:
} else {
/*
* An octopus. If we can reach all the remote we are up
* to date.
*/
int up_to_date = 1;
...
if (up_to_date) {
finish_up_to_date("Already up-to-date. Yeeah!");
return 0;
}
}
You do not want to fail this case, where you tried to merge others that
have already been merged, when --ff-only is given, do you? After all, all
that you are interested in is "do not create a new merge commit".
If you scroll down a bit from there, you will see:
/* We are going to make a new commit. */
git_committer_info(IDENT_ERROR_ON_NO_NAME);
/*
* At this point, we need a real merge. No matter what strategy
* we use, it would operate on the index, possibly affecting the
This is where "if (!common) ;" will fall through to.
If your goal is to prevent the user from creating a new merge commit,
the logical place to do so would be immediately before that comment,
independent from all the if..elseif..fi conditional arms that come before
it, I think.
You also need to disable allow_trivial when ff-only is given, but I think
that goes without saying. If you do not want to allow creating a new
merge commit, you do not want even a trivial merge to happen.
next prev parent reply other threads:[~2009-01-29 22:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-28 12:53 [PATCH] Add --ff-only flag to git-merge Yuval Kogman
2009-01-28 13:26 ` Johannes Schindelin
2009-01-28 13:29 ` Yuval Kogman
2009-01-28 14:35 ` Sverre Rabbelier
2009-01-28 21:12 ` Junio C Hamano
2009-01-29 20:57 ` Yuval Kogman
2009-01-29 22:29 ` Junio C Hamano [this message]
2009-01-30 4:32 ` [PATCH] Add --ff-only flag to git-merge (take 2) Yuval Kogman
2009-01-30 4:32 ` [PATCH] Add --ff-only flag to git-merge Yuval Kogman
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=7vbptpeoge.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=nothingmuch@woobling.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.
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).