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

[PATCH v2] test: add test for git bisect skip with --term* arguments

From
Bagas Sanjaya <bagasdotme@gmail.com>
Date
Apr 21, 2021, 04:08 UTC
Message-ID
<20210421040808.14185-1-bagasdotme@gmail.com>
In-Reply-To
<20210418151459.GC10839@aaberge.net>

Trygve Aaberge reported the current git bisect breakage on [1]. After starting bisection with --term-new and --term-old arguments to git bisect start, skipping with git bisect skip does not change HEAD as expected.

Let's add the test to catch this breakage.
[1]: https://lore.kernel.org/git/20210418151459.GC10839@aaberge.net/
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
Changes from v1:
  * style changes requested by Junio
  * rename test script and edit test description to be more descriptive
  * remove exec </dev/null (I don't know what it means)
  * repo initialization is now on test_expect_success block (as
    requested by Junio)
  
 t/t6031-bisect-skip-with-term.sh | 36 ++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100755 t/t6031-bisect-skip-with-term.sh
diff --git a/t/t6031-bisect-skip-with-term.sh b/t/t6031-bisect-skip-with-term.sh
new file mode 100755
index 0000000000..f1e1c4c1a2
--- /dev/null
+++ b/t/t6031-bisect-skip-with-term.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2021 Bagas Sanjaya
+#
+
+test_description='Tests skipping bisect which the bisection is started with --term* arguments'
+
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+. ./test-lib.sh
+
+# hash variables to be used in bisection test
+HASH_SKIPPED_FROM=
+HASH_SKIPPED_TO=
+
+# test repo initialization
+test_expect_success 'initialize testing repo with 20 commits' '
+	for i in $(test_seq 1 20); do
+		echo $i >>test &&
+		git add test && git commit -m "commit $i" &&
+		test_tick
+	done
+'
+
+# actual bisection test
+test_expect_success 'test moving HEAD when skip bisecting' '
+	git bisect start --term-new=ok --term-old=whoops HEAD HEAD~9 &&
+	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
+'
+
+test_done

base-commit: b0c09ab8796fb736efa432b8e817334f3e5ee75a
-- 
2.25.1
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 11 in “Using --term-* with bisect breaks skip”
  1. Trygve AabergeApr 18, 2021
  2. Bagas SanjayaApr 19, 2021
  3. Trygve AabergeApr 19, 2021
  4. Bagas SanjayaApr 19, 2021
  5. Junio C HamanoApr 19, 2021
  6. Trygve AabergeApr 19, 2021
  7. test: add test for git bisect skip with --term* argumentsBagas Sanjaya, Apr 20, 2021
  8. Junio C HamanoApr 20, 2021
  9. test: add test for git bisect skip with --term* argumentsBagas Sanjaya, Apr 21, 2021
  10. Junio C HamanoApr 21, 2021
  11. Bagas SanjayaApr 22, 2021

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.