public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5•se>
To: Git Mailing List <git@vger•kernel.org>,
	Junio C Hamano <gitster@pobox•com>,
	Stephen Haberman <stephen@exigencecorp•com>
Subject: [PATCH 3/3] git pull: Support --preserve-merges as a flag to rebase
Date: Tue, 23 Sep 2008 22:58:20 +0200	[thread overview]
Message-ID: <48D9586C.4010102@op5.se> (raw)

Now that "git rebase" supports non-interactive rebases
preserving merges, this patch is the next logical step
for those who wish to use such a workflow.

Since this patch makes the last test marked as expecting
failure in t3409-rebase-preserve-merges, we now alter it
to expect success.

Signed-off-by: Andreas Ericsson <ae@op5•se>
---
 Documentation/git-pull.txt        |    4 ++++
 git-pull.sh                       |    6 +++++-
 t/t3409-rebase-preserve-merges.sh |    2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt
index 7578623..333fc55 100644
--- a/Documentation/git-pull.txt
+++ b/Documentation/git-pull.txt
@@ -47,6 +47,10 @@ unless you have read linkgit:git-rebase[1] carefully.
 --no-rebase::
 	Override earlier --rebase.
 
+--preserve-merges::
+	Preserves merge commits when rebasing. Implies --rebase,
+	so the same warnings naturally apply.
+
 include::fetch-options.txt[]
 
 include::pull-fetch-param.txt[]
diff --git a/git-pull.sh b/git-pull.sh
index 75c3610..270a50d 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -58,6 +58,10 @@ do
 	-r|--r|--re|--reb|--reba|--rebas|--rebase)
 		rebase=true
 		;;
+	--preserve-merges) # no short option for this
+		preserve_merges="--preserve-merges"
+		rebase=true
+		;;
 	--no-r|--no-re|--no-reb|--no-reba|--no-rebas|--no-rebase)
 		rebase=false
 		;;
@@ -179,7 +183,7 @@ fi
 
 merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit
 test true = "$rebase" &&
-	exec git-rebase $strategy_args --onto $merge_head \
+	exec git-rebase $preserve_merges $strategy_args --onto $merge_head \
 	${oldremoteref:-$merge_head}
 exec git-merge $no_stat $no_commit $squash $no_ff $log_arg $strategy_args \
 	"$merge_name" HEAD $merge_head
diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh
index 21b8c79..9a376ef 100644
--- a/t/t3409-rebase-preserve-merges.sh
+++ b/t/t3409-rebase-preserve-merges.sh
@@ -51,7 +51,7 @@ test_expect_success 'setup for merge-preserving rebase' \
 	git commit -a -m "Modify B2"
 '
 
-test_expect_failure 'git pull --rebase -p on moved topic' '
+test_expect_success 'git pull --rebase -p on moved topic' '
 	cd clone1 &&
 	git pull --rebase --preserve-merges &&
 	test $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) = 1
-- 
1.6.0.2.307.gc4275.dirty

             reply	other threads:[~2008-09-23 20:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-23 20:58 Andreas Ericsson [this message]
2008-10-15  6:59 ` [PATCH 3/3] git pull: Support --preserve-merges as a flag to rebase Stephen Haberman

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=48D9586C.4010102@op5.se \
    --to=ae@op5$(echo .)se \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=stephen@exigencecorp$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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