git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Price <price@ksplice.com>
To: unlisted-recipients:; (no To-header on input)
Cc: git@vger.kernel.org
Subject: Re: merge ignores --no-commit in fast-forward case
Date: Fri, 18 Sep 2009 15:47:18 -0400	[thread overview]
Message-ID: <20090918194717.GA18999@dr-wily.mit.edu> (raw)
In-Reply-To: <7vocpfz4gm.fsf@alter.siamese.dyndns.org>

I've hit this issue in scripts where someone has written

  if ! git merge some-branch --no-commit; then
    # deal or have the user deal
  fi

  git commit -m '...'

intending that if the merge succeeds it has left the changes from
some-branch uncommitted.  And the script works, until for some reason
some-branch is on top of HEAD.  So Tomas is not the only person who
was surprised or confused by the present behavior. =)

In this case the workaround is to add --no-ff to the command, which is
effectively what the proposed change would do automatically.

Suppose we were to make such a change in 1.7.0 or a later version.
What would the transition plan need to accomplish?  For instance,
we could print a warning every time 'merge --no-commit' does a
fast-forward, and make the change in a later version -- might that suffice?

Cheers,
Greg


PS - Here's one version of a documentation patch for #3.

>From 83282bbbd0c918016e71e4ff6fd8a823315fed0e Mon Sep 17 00:00:00 2001
From: Greg Price <price@ksplice.com>
Date: Fri, 18 Sep 2009 15:34:19 -0400
Subject: [PATCH] Document behavior of --no-commit on fast forward.

This behavior can be surprising, so document it.

Signed-off-by: Greg Price <price@ksplice.com>
---
 Documentation/merge-options.txt |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/Documentation/merge-options.txt
b/Documentation/merge-options.txt
index adadf8e..6015e5d 100644
--- a/Documentation/merge-options.txt
+++ b/Documentation/merge-options.txt
@@ -31,7 +31,10 @@
 --no-commit::
        Perform the merge but pretend the merge failed and do
        not autocommit, to give the user a chance to inspect and
-       further tweak the merge result before committing.
+       further tweak the merge result before committing.  If the
+       merge resolved as a fast-forward, the branch pointer will
+       be updated as usual; --no-ff can be combined with this
+       option to always preserve the branch pointer.
 
 --commit::
        Perform the merge and commit the result. This option can
-- 
1.6.3.1.499.ge7b8da

  reply	other threads:[~2009-09-18 19:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-13  6:40 merge ignores --no-commit in fast-forward case Tomas Carnecky
2009-09-13  7:30 ` Junio C Hamano
2009-09-18 19:47   ` Greg Price [this message]
2009-09-18 23:05     ` Junio C Hamano
2009-09-20 14:04       ` Paolo Bonzini
2009-09-19  8:09   ` Björn Steinbrink

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=20090918194717.GA18999@dr-wily.mit.edu \
    --to=price@ksplice.com \
    --cc=git@vger.kernel.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).