git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jörg Sommer" <joerg@alea.gnuu.de>
To: git@vger.kernel.org
Cc: gitster@pobox.com, "Jörg Sommer" <joerg@alea.gnuu.de>
Subject: [PATCH v2 2/5] New test: no merges without preserve merges
Date: Sat, 22 Mar 2008 15:08:24 +0100	[thread overview]
Message-ID: <1206194907-3340-2-git-send-email-joerg@alea.gnuu.de> (raw)
In-Reply-To: <1206194907-3340-1-git-send-email-joerg@alea.gnuu.de>

This test checks that no merges are included, if --preserve-merges is not
given.

To see a difference between with and without merges add a second commit
to the branch to-be-preserved. Otherwise you exchange one merge with one
commit, which isn't cognizable with EXPECT_COUNT.

The for loop in the test looks somewhat strange, but I didn't saw a
different way (than || exit 1) to make the test fail if an inner test
fails. Recall: The exit code of a for loop is the exit code of the last
command in the last pass, i.e. “for a in 1 2; do test $a != 1; do”
returns success.

Signed-off-by: Jörg Sommer <joerg@alea.gnuu.de>
---
 t/t3404-rebase-interactive.sh |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

This patch must be applied after the first patch that fixes rebase,
because it triggers a bug.

diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 9cf873f..8de1f21 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -195,6 +195,9 @@ test_expect_success 'preserve merges with -p' '
 	git add unrelated-file &&
 	test_tick &&
 	git commit -m "unrelated" &&
+	echo 2 > unrelated-file &&
+	test_tick &&
+	git commit -m "second unrelated commit" unrelated-file &&
 	git checkout -b to-be-rebased master &&
 	echo B > file1 &&
 	test_tick &&
@@ -212,6 +215,18 @@ test_expect_success 'preserve merges with -p' '
 	test $(git show HEAD~2:file1) = B
 '
 
+test_expect_success 'no merges without preserve merges' '
+	head=$(git rev-parse HEAD) &&
+	test_tick &&
+	EXPECT_COUNT=4 git rebase -i branch1 &&
+	test $(git rev-parse HEAD) != $head &&
+        for i in 0 1 2 3
+	do
+		test $? -eq 0 &&
+		test "$(git rev-list --parents -1 HEAD~$i | tr -dc " ")" = " "
+	done
+'
+
 test_expect_success '--continue tries to commit' '
 	test_tick &&
 	! git rebase -i --onto new-branch1 HEAD^ &&
-- 
1.5.4.4

  reply	other threads:[~2008-03-22 14:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-22  1:19 [PATCH] rebase with preserve merges should not show merged commits Jörg Sommer
2008-03-22  1:19 ` [PATCH] Check for non‐foreign commits in rebase-interactive test Jörg Sommer
2008-03-22  1:19   ` [PATCH] Handle fast forward correctly in rebase with preserve merges Jörg Sommer
2008-03-22  1:19     ` [PATCH] New tests to check " Jörg Sommer
2008-03-22  1:33 ` [PATCH] rebase with preserve merges should not show merged commits Johannes Schindelin
2008-03-22  9:43   ` Jörg Sommer
2008-03-22 11:22     ` Johannes Schindelin
2008-03-22  1:52 ` Björn Steinbrink
2008-03-22  9:40   ` Jörg Sommer
2008-03-22 12:37     ` Björn Steinbrink
2008-03-22 14:06   ` Jörg Sommer
2008-03-22 15:12     ` Björn Steinbrink
2008-03-22 15:37       ` Jörg Sommer
2008-03-22 14:08 ` [PATCH v2 1/5] " Jörg Sommer
2008-03-22 14:08   ` Jörg Sommer [this message]
2008-03-22 14:08     ` [PATCH v2 3/5] Check for non‐foreign commits in rebase-interactive test Jörg Sommer
2008-03-22 14:08       ` [PATCH v2 4/5] Handle fast forward correctly in rebase with preserve merges Jörg Sommer
2008-03-22 14:08         ` [PATCH v2 5/5] New tests to check " Jörg Sommer
2008-03-22 14:46   ` [PATCH v2 1/5] rebase with preserve merges should not show merged commits Johannes Schindelin

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=1206194907-3340-2-git-send-email-joerg@alea.gnuu.de \
    --to=joerg@alea.gnuu.de \
    --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).