[PATCH 4/5] Add test for redundant rebase
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