git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 5/5] Add test for rebase with merges amd redundant commits

From
David Greene <greened@obbligato.org>
Date
Jan 11, 2016, 05:00 UTC
Message-ID
<1452488421-26823-6-git-send-email-greened@obbligato.org>
In-Reply-To
<1452488421-26823-1-git-send-email-greened@obbligato.org>
From: "David A. Greene" <greened@obbligato.org>

This tests rebase --preserve-merges in the presence of redundant commits when there are actual erges being rebased. It primarily exercises the --skip-redundant-commits option.

Signed-off-by: David A. Greene <greened@obbligato.org>
---
 t/t3429-rebase-redundant-merge.sh | 73 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100755 t/t3429-rebase-redundant-merge.sh
diff --git a/t/t3429-rebase-redundant-merge.sh b/t/t3429-rebase-redundant-merge.sh
new file mode 100755
index 0000000..f677bb1
--- /dev/null
+++ b/t/t3429-rebase-redundant-merge.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+test_description='git rebase tests for redundant commits
+
+This test runs git rebase and tests handling of redundant commits.
+'
+. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-rebase.sh
+
+# Setup this graph:
+#
+# O
+# o-o-o-o-o R/rebaseOR/rebaseSR/rebasemergeOR/rebasemergeSR
+#  \   /
+#   o-o S
+#
+test_expect_success 'setup' '
+	test_commit README &&
+	git branch O &&
+	git checkout -b branch O &&
+	test_commit branch1 &&
+	test_commit branch2 &&
+	git branch S &&
+	git checkout master &&
+	test_commit master1 &&
+	test_commit master2 &&
+	git merge branch -m "Merge branch to master" &&
+	test_commit merged1 &&
+	git branch R &&
+	git branch rebaseOR &&
+	git branch rebaseSR &&
+	git branch rebasemergeOR &&
+	git branch rebasemergeskipOR &&
+	git branch rebasemergeSR &&
+	git branch rebasemergeskipSR
+'
+
+test_expect_success 'rebase O..R --onto S' '
+	reset_rebase &&
+	git checkout rebaseOR &&
+	git rebase O --onto S
+'
+
+test_expect_success 'rebase S..R --onto S' '
+	reset_rebase &&
+	git checkout rebaseSR &&
+	git rebase S --onto S
+'
+
+test_expect_success 'rebase O..R --onto S preserving merges fails' '
+	reset_rebase &&
+	git checkout rebasemergeOR &&
+	test_must_fail git rebase --preserve-merges O --onto S
+'
+
+test_expect_success 'rebase O..R --onto S preserving merges --skip-redundant' '
+	reset_rebase &&
+	git checkout rebasemergeskipOR &&
+	git rebase --skip-redundant-commits --preserve-merges O --onto S
+'
+
+test_expect_success 'rebase S..R --onto S preserving merges' '
+	reset_rebase &&
+	git checkout rebasemergeSR &&
+	git rebase --preserve-merges S --onto S
+'
+
+test_expect_success 'rebase S..R --onto S preserving merges --skip-redundant' '
+	reset_rebase &&
+	git checkout rebasemergeskipSR &&
+	git rebase --skip-redundant-commits --preserve-merges S --onto S
+'
+test_done
-- 
2.6.1
Previous: David GreeneNext: Eric Sunshine
Message 8 of 9 in “Teach cherry-pick and rebase to ignore redundant commits”
  1. Teach cherry-pick and rebase to ignore redundant commitsDavid Greene, Jan 11, 2016
  2. 1/5 Teach cherry-pick to skip redundant commits if askedDavid Greene, Jan 11, 2016
  3. Junio C HamanoJan 11, 2016
  4. David A. GreeneJan 12, 2016
  5. 2/5 Add test for cherry-pick --skip-redundant-commitsDavid Greene, Jan 11, 2016
  6. 3/5 Add --skip-redundant-commits option to rebaseDavid Greene, Jan 11, 2016
  7. 4/5 Add test for redundant rebaseDavid Greene, Jan 11, 2016
  8. 5/5 Add test for rebase with merges amd redundant commitsDavid Greene, Jan 11, 2016
  9. Eric SunshineJan 11, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.