git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: "Clemens Buchacher" <drizzd@aon.at>,
	"Björn Steinbrink" <B.Steinbrink@gmx.de>,
	"Daniel Barkalow" <barkalow@iabervon.org>,
	"Thomas Rast" <trast@student.ethz.ch>
Subject: [PATCH] git-merge: imply --no-ff when --no-commit is given
Date: Wed, 21 Oct 2009 14:46:50 -0700	[thread overview]
Message-ID: <7viqe81ktx.fsf_-_@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7v3a5c2zrr.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Wed\, 21 Oct 2009 14\:38\:48 -0700")

Traditionally "git merge --no-commit" meant just that: do not create a new
commit even when a merge succeeds.  But this leads to confusion when the
merged commit is a descendant of the current commit, in which case we
succeed the merge by fast-forwarding and without creating a new commit.

Make --no-commit imply --no-ff; --no-commit is a request by the user to
tweak the resulting merge and it is clear indication that the user wants
to have a merge, even if it is an extra one, to futz with.

There is a test that relies on --no-commit silently fast forwarding; that
is obviously broken by this change.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * This is another possibility, which I think is worse than the other one
   in practice but the justification sounds more respectable.

   Unlike the other one, this will still make --no-commit a no-op when you
   are already up-to-date.  As I do not think --no-ff makes much sense in
   my own workflow (either here or dayjob) it is not exactly my itch, but
   I suspect that people who wanted to have --no-ff may want to create an
   extra commit even in such a case; it may be a bug to allow up-to-date
   when --no-ff is given.  Yes, it would make the --no-ff even more insane
   than it already is, but I suspect it would be more consistent with the
   original reasoning of wanting to have the option in the first place,
   namely, to leave the trace of the fact that a "merge" was done at that
   point in the history.

 builtin-merge.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/builtin-merge.c b/builtin-merge.c
index b6b8428..fa86799 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -874,6 +874,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		option_commit = 0;
 	}
 
+	if (!option_commit)
+		allow_fast_forward = 0;
+
 	if (!argc)
 		usage_with_options(builtin_merge_usage,
 			builtin_merge_options);
-- 
1.6.5.1.107.gba912

  parent reply	other threads:[~2009-10-21 21:47 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-20 17:47 [RFC] pull/fetch rename Thomas Rast
2009-10-20 19:59 ` Wesley J. Landaker
2009-10-20 21:46   ` Junio C Hamano
2009-10-20 22:53     ` Thomas Rast
2009-10-20 23:11       ` Junio C Hamano
2009-10-21  2:01         ` Wesley J. Landaker
2009-10-20 23:16       ` Junio C Hamano
2009-10-20 21:42 ` Nanako Shiraishi
2009-10-20 22:41   ` Thomas Rast
2009-10-20 23:56 ` Daniel Barkalow
2009-10-21  3:06   ` Björn Steinbrink
2009-10-21  4:22     ` Daniel Barkalow
2009-10-21 11:57       ` Björn Steinbrink
2009-10-21 17:12         ` Daniel Barkalow
2009-10-21  6:22     ` Junio C Hamano
2009-10-21 17:19       ` Clemens Buchacher
2009-10-21 17:21       ` [PATCH] modernize fetch/merge/pull examples Clemens Buchacher
2009-10-21 21:38         ` Junio C Hamano
2009-10-21 21:41           ` [RFC/PATCH] git-merge: forbid fast-forward and up-to-date when --no-commit is given Junio C Hamano
2009-10-22 10:21             ` Nanako Shiraishi
2009-10-22 22:26               ` Junio C Hamano
2009-10-21 21:46           ` Junio C Hamano [this message]
2009-10-22  6:35             ` [PATCH] git-merge: imply --no-ff " Clemens Buchacher
2009-10-22  8:51         ` [PATCH] modernize fetch/merge/pull examples Thomas Rast
2009-10-22  9:48       ` [RFC] pull/fetch rename Thomas Rast
2009-10-21  6:30   ` Mike Hommey
2009-10-21  6:33     ` Junio C Hamano
2009-10-21  7:06       ` Mike Hommey
2009-10-21  7:22       ` Junio C Hamano
2009-10-21  7:45         ` Jeff King
2009-10-21  7:47           ` Jeff King
2009-10-24  6:30           ` 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=7viqe81ktx.fsf_-_@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=B.Steinbrink@gmx.de \
    --cc=barkalow@iabervon.org \
    --cc=drizzd@aon.at \
    --cc=git@vger.kernel.org \
    --cc=trast@student.ethz.ch \
    /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).