git.vger.kernel.org archive mirror
 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 1/3] Prepare for non-interactive merge-preserving rebase
Date: Tue, 23 Sep 2008 22:57:26 +0200	[thread overview]
Message-ID: <48D95836.6040200@op5.se> (raw)

This patch adds two tests (really three, but one of
them just handles setup) which we currently expect
to fail.

One of them tests "git rebase -p", without the -i flag,
to make sure it works without phony editors and suchlike.

The other tests "git pull --rebase --preserve-merges"
to make sure that the same functionality exists there.

The test was originally written by Stephen Habermann
<stephen@exigencecorp.com> but has been significantly
modified since its creation.

Signed-off-by: Andreas Ericsson <ae@op5.se>
---

Stephen, I had to modify the tests a bit to get them to work with
how I implemented the merge-preserving rebase, and also to remove
a lot of the cruft that was previously in there. Hope you're ok
with the attribution in the commit message.

 t/t3409-rebase-preserve-merges.sh |   68 +++++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)
 create mode 100644 t/t3409-rebase-preserve-merges.sh

diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh
new file mode 100644
index 0000000..532b220
--- /dev/null
+++ b/t/t3409-rebase-preserve-merges.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+#
+# Copyright(C) 2008 Stephen Habermann & Andreas Ericsson
+#
+test_description='git rebase -p should preserve merges
+
+This test runs various incantations of "git rebase -p" and checks
+that merges are properly carried along
+'
+. ./test-lib.sh
+
+GIT_AUTHOR_EMAIL=bogus_email_address
+export GIT_AUTHOR_EMAIL
+
+#echo 'Setting up:
+#
+#A1--A2  <-- origin/master
+# \   \
+#  B1--M  <-- topic
+#   \
+#    B2  <-- origin/topic
+#
+#'
+
+test_expect_success 'setup for merge-preserving rebase' \
+	'echo First > A &&
+	git add A &&
+	git-commit -m "Add A1" &&
+	git checkout -b topic &&
+	echo Second > B &&
+	git add B &&
+	git-commit -m "Add B1" &&
+	git checkout -f master &&
+	echo Third >> A &&
+	git-commit -a -m "Modify A2" &&
+
+	git clone ./. clone1 &&
+	cd clone1 &&
+	git checkout -b topic origin/topic &&
+	git merge origin/master &&
+	cd ..
+
+	git clone ./. clone2
+	cd clone2 &&
+	git checkout -b topic origin/topic &&
+	git merge origin/master &&
+	cd .. &&
+
+	git checkout topic &&
+	echo Fourth >> B &&
+	git commit -a -m "Modify B2"
+'
+
+test_expect_failure '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
+'
+
+test_expect_failure 'rebase -p merge on moved topic' '
+	cd ../clone2 &&
+	git fetch &&
+	git rebase -p origin/topic &&
+	test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
+	test 1 = $(git rev-list --all --pretty=oneline | grep "Merge commit" | wc -l)
+'
+
+test_done
-- 
1.6.0.2.307.gc4275.dirty

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

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-23 20:57 Andreas Ericsson [this message]
2008-09-23 21:22 ` [PATCH 1/3] Prepare for non-interactive merge-preserving rebase Stephen Haberman
2008-09-23 21:30   ` Andreas Ericsson
2008-09-24  0:10     ` SZEDER Gábor
2008-09-24  6:17       ` Johannes Sixt
2008-09-24  7:13       ` Andreas Ericsson
2008-10-15  8:07       ` Stephen Haberman
2008-09-27 17:55   ` Andreas Ericsson
2008-09-27 19:20     ` Stephen Haberman
2008-09-29 16:01     ` Shawn O. Pearce
2008-09-29 16:04       ` Andreas Ericsson
2008-09-29 16:11         ` Shawn O. Pearce
2008-10-01 20:27 ` [PATCH] Add branch.autosetuppreservemerges and branch.<name>.preservemerges 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=48D95836.6040200@op5.se \
    --to=ae@op5.se \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=stephen@exigencecorp.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).