git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Lundy <mike@fluffypenguin.org>
To: git@vger.kernel.org
Cc: gitster@pobox.com, mike@fluffypenguin.org
Subject: [PATCH] Support merge strategy options in rebase
Date: Sat, 27 Feb 2010 20:43:27 -0800	[thread overview]
Message-ID: <1267332207-22675-1-git-send-email-mike@fluffypenguin.org> (raw)

The manpage says that git-rebase supports merge strategies, but the rebase
command doesn't know about -X, and gives the usage when presented with it.

Signed-off-by: Mike Lundy <mike@fluffypenguin.org>
---

 My test modification only makes sure that the argument is accepted; it assumes
 merge strategies are already tested and they won't actually be needed, because
 there's no conflict.

 git-rebase.sh           |   15 ++++++++++++++-
 t/t3402-rebase-merge.sh |    3 ++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index fb4fef7..c2a92af 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -44,6 +44,7 @@ To restore the original branch and stop rebasing run \"git rebase --abort\".
 "
 unset newbase
 strategy=recursive
+strategy_opts=
 do_merge=
 dotest="$GIT_DIR"/rebase-merge
 prec=4
@@ -111,7 +112,7 @@ call_merge () {
 	then
 		export GIT_MERGE_VERBOSITY=1
 	fi
-	git-merge-$strategy "$cmt^" -- "$hd" "$cmt"
+	git-merge-$strategy $strategy_opts "$cmt^" -- "$hd" "$cmt"
 	rv=$?
 	case "$rv" in
 	0)
@@ -295,6 +296,18 @@ do
 	-M|-m|--m|--me|--mer|--merg|--merge)
 		do_merge=t
 		;;
+	-X*|--strategy-option*)
+		case "$#,$1" in
+		*,*=*)
+			strategy_opts="$strategy_opts --`expr "z$1" : 'z-[^=]*=\(.*\)'`" ;;
+		1,*)
+			usage ;;
+		*)
+			strategy_opts="$strategy_opts --$2"
+			shift ;;
+		esac
+		do_merge=t
+		;;
 	-s=*|--s=*|--st=*|--str=*|--stra=*|--strat=*|--strate=*|\
 		--strateg=*|--strategy=*|\
 	-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
diff --git a/t/t3402-rebase-merge.sh b/t/t3402-rebase-merge.sh
index 7b7d072..f273a37 100755
--- a/t/t3402-rebase-merge.sh
+++ b/t/t3402-rebase-merge.sh
@@ -51,7 +51,8 @@ test_expect_success 'reference merge' '
 PRE_REBASE=$(git rev-parse test-rebase)
 test_expect_success rebase '
 	git checkout test-rebase &&
-	GIT_TRACE=1 git rebase --merge master
+	GIT_TRACE=1 git rebase --merge master &&
+	GIT_TRACE=1 git rebase --merge -X theirs master
 '
 
 test_expect_success 'test-rebase@{1} is pre rebase' '
-- 
1.7.0.95.g91ec93

             reply	other threads:[~2010-02-28  4:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-28  4:43 Mike Lundy [this message]
2010-02-28 21:17 ` [PATCH] Support merge strategy options in rebase 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=1267332207-22675-1-git-send-email-mike@fluffypenguin.org \
    --to=mike@fluffypenguin.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).