Skip to contentSkip to conversation

t6030: add test for git bisect skip started with --term* arguments

PATCH Superseded Bagas Sanjaya 1 participant 1 message Apr 23, 2021

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t6030: add test for git bisect skip started with --term* arguments

Trygve Aaberge reported [1] git bisect breakage when the bisection is started with --term* arguments (--term-new and --term-old). In that case, skipping with git bisect skip should cause HEAD to be changed, but actually the HEAD stayed same after skipping.

Let's add the test to catch the breakage. Because there isn't any fixes yet, mark the test as test_expect_failure.

[1]: https://lore.kernel.org/git/[email protected]/

---

Junio suggested that I should had written this test in t6030, not in separate script as per [2], so that I could reuse the history from existing tests.

[2]: https://lore.kernel.org/git/[email protected]/

 t/t6030-bisect-porcelain.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)
t/t6030-bisect-porcelain.sh +12 -0
index 32bb66e1ed..c500fa893d 100755
@@ -299,6 +299,18 @@ test_expect_success 'bisect skip and bisect replay' '
 	git bisect reset
 '
 
+# Bisect is started with --term-new and --term-old arguments,
+# then skip. The HEAD should be changed.
+# FIXME: Mark this test as test_expect_failure. Remove the FIXME and
+# mark as test_expect_success when this test successes (fixed bug).
+test_expect_failure '"bisect skip: bisection is started with --term*"' '
+	git bisect start --term-new=fixed --term-old=unfixed $HASH5 $HASH1 &&
+	HASH_SKIPPED_FROM=$(git rev-parse --verify HEAD) &&
+	git bisect skip &&
+	HASH_SKIPPED_TO=$(git rev-parse --verify HEAD) &&
+	test $HASH_SKIPPED_FROM != $HASH_SKIPPED_TO
+'
+
 HASH6=
 test_expect_success 'bisect run & skip: cannot tell between 2' '
 	add_line_into_file "6: Yet a line." hello &&

base-commit: 311531c9de557d25ac087c1637818bd2aad6eb3a

Signature · 1 line
2.25.1