Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: [PATCH] git-merge: make it usable as the first class UI again.
Date: Fri, 26 Jan 2007 01:28:22 -0800	[thread overview]
Message-ID: <7v4pqe16ix.fsf@assigned-by-dhcp.cox.net> (raw)

reflog wants to have a short-and-sweet single line message, but
its set_reflog_action was slurping the whole command line arguments.
When given a multi-line commit message from the command line, reflog
code refused to update the ref with the resulting commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * When pull threw huge merge message, it has already set the
   reflog action on its own so this breakage was hidden.  Also
   because most of the time people did not specify -m message
   (or use the old-style <msg> HEAD <others>) from the command
   line, nobody seems to have noticed this.

 git-merge.sh |    2 +-
 git-pull.sh  |   27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/git-merge.sh b/git-merge.sh
index 7b59026..91909b7 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -7,7 +7,7 @@ USAGE='[-n] [--no-commit] [--squash] [-s <strategy>] [-m=<merge-message>] <commi
 
 SUBDIRECTORY_OK=Yes
 . git-sh-setup
-set_reflog_action "merge $*"
+set_reflog_action merge
 require_work_tree
 cd_to_toplevel
 
diff --git a/git-pull.sh b/git-pull.sh
index a3665d7..fc76aea 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -51,6 +51,33 @@ do
 	shift
 done
 
+if test "X$1" = X.
+then
+	# We are merging from this repository.  We can avoid fetch
+	# and go right into merge if the user isn't doing something
+	# odd like asking us to also update tracking branches in
+	# this repository as part of the pull.  Yeah, they probably
+	# shouldn't do that - but we allowed it in the past...
+	#
+	direct_merge=1
+	for remote
+	do
+		case "$remote" in
+		*:*) direct_merge=0; break;;
+		esac
+	done
+	if test $direct_merge = 1
+	then
+		shift
+		exec git-merge \
+			$no_summary $no_commit $squash $strategy_args \
+			"$@"
+	else
+		echo >&2 "Clever... Updating tracking branch while pulling from yourself."
+		echo >&2
+	fi
+fi
+
 orig_head=$(git-rev-parse --verify HEAD 2>/dev/null)
 git-fetch --update-head-ok "$@" || exit 1
 
-- 
1.5.0.rc2.g8a816

             reply	other threads:[~2007-01-26  9:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-26  9:28 Junio C Hamano [this message]
2007-01-26 10:24 ` [PATCH] git-merge: make it usable as the first class UI again 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=7v4pqe16ix.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --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