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

[PATCH 4/5] Add test for redundant rebase

From
David Greene <greened@obbligato.org>
Date
Jan 11, 2016, 05:00 UTC
Message-ID
<1452488421-26823-5-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>
Test that rebase --skip-redundant-commits works.
Signed-off-by: David A. Greene <greened@obbligato.org>
---
 t/t3428-rebase-redundant.sh | 100 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)
 create mode 100755 t/t3428-rebase-redundant.sh
diff --git a/t/t3428-rebase-redundant.sh b/t/t3428-rebase-redundant.sh
new file mode 100755
index 0000000..eea63e9
--- /dev/null
+++ b/t/t3428-rebase-redundant.sh
@@ -0,0 +1,100 @@
+#!/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
+
+test_expect_success 'setup' '
+	test_commit README &&
+	git checkout -b empty &&
+	test_commit empty1 &&
+	test_commit empty2 &&
+	git commit -m "Empty commit 1" --allow-empty &&
+	test_commit empty3 &&
+	git checkout -b onto master &&
+	test_commit onto1 &&
+	test_commit onto2 &&
+	test_commit onto3 &&
+	git checkout -b dev master &&
+	test_commit dev1 &&
+	test_commit dev2 &&
+	test_commit dev3 &&
+	git checkout -b redundant master &&
+	test_commit onto1 onto1.t onto1 onto1-2 &&
+	test_commit onto2 onto2.t onto2 onto2-2 &&
+	test_commit onto3 onto3.t onto3 onto3-2 &&
+	git checkout -b redundant-empty redundant &&
+	git commit -m "Empty commit 2" --allow-empty &&
+	test_commit empty4
+'
+
+test_expect_success 'default rebase without empty commits' '
+	reset_rebase &&
+	git checkout -b default-non-empty dev &&
+	git rebase --preserve-merges --onto onto master
+'
+
+test_expect_success 'default rebase with empty commits' '
+	reset_rebase &&
+	git checkout -b default-empty empty &&
+	git rebase --preserve-merges --onto onto master
+'
+
+test_expect_success 'default rebase with redundant commits' '
+	reset_rebase &&
+	git checkout -b default-redundant redundant &&
+	git rebase --preserve-merges --onto onto --root
+'
+
+test_expect_success 'rebase --skip-redundant without empty commits' '
+	reset_rebase &&
+	git checkout -b skip-redundant-non-empty dev &&
+	git rebase --skip-redundant-commits --preserve-merges --onto onto master
+'
+
+test_expect_success 'rebase --skip-redundant with empty commits' '
+	reset_rebase &&
+	git checkout -b skip-redundant-empty empty &&
+	git rebase --skip-redundant-commits --preserve-merges --onto onto master
+'
+
+test_expect_success 'rebase --skip-redundant with redundant commits' '
+	reset_rebase &&
+	git checkout -b skip-redundant-redundant redundant &&
+	git rebase --skip-redundant-commits --preserve-merges --onto onto --root
+'
+
+test_expect_success 'rebase --skip-redundant with empty and redundant commits' '
+	reset_rebase &&
+	git checkout -b skip-redundant-empty-redundant redundant-empty &&
+	git rebase --skip-redundant-commits --preserve-merges --onto onto --root
+'
+
+test_expect_success 'rebase --keep-empty --skip-redundant without empty commits' '
+	reset_rebase &&
+	git checkout -b keep-empty-skip-redundant-non-empty dev &&
+	git rebase --keep-empty --skip-redundant-commits --preserve-merges --onto onto master
+'
+
+test_expect_success 'rebase --keep-empty --skip-redundant with empty commits' '
+	reset_rebase &&
+	git checkout -b keep-empty-skip-redundant-empty empty &&
+	git rebase --keep-empty --skip-redundant-commits --preserve-merges --onto onto master
+'
+
+test_expect_success 'rebase --keep-empty --skip-redundant with redundant commits' '
+	reset_rebase &&
+	git checkout -b keep-empty-skip-redundant-redundant redundant &&
+	git rebase --keep-empty --skip-redundant-commits --preserve-merges --onto onto --root
+'
+
+test_expect_success 'rebase --keep-empty --skip-redundant with empty and redundant commits' '
+	reset_rebase &&
+	git checkout -b keep-empty-skip-redundant-empty-redundant redundant-empty &&
+	git rebase --skip-redundant-commits --preserve-merges --onto onto --root
+'
+
+test_done
-- 
2.6.1
Previous: David GreeneNext: David Greene
Message 7 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.