git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bagas Sanjaya <bagasdotme@gmail.com>
To: trygveaa@gmail.com
Cc: git@vger.kernel.org, mirucam@gmail.com, pranit.bauva@gmail.com,
	christian.couder@gmail.com, Bagas Sanjaya <bagasdotme@gmail.com>
Subject: [PATCH] test: add test for git bisect skip with --term* arguments
Date: Tue, 20 Apr 2021 19:34:36 +0700	[thread overview]
Message-ID: <20210420123435.35936-1-bagasdotme@gmail.com> (raw)
In-Reply-To: <20210418151459.GC10839@aaberge.net>

The current git bisect breakage happens when skipping in the middle of
bisect session which is started with --term-new and --term-old
arguments. This test expect that HEAD changes after skipping, in other
words HEAD before and after skipping must be different.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
NOTE: this patch is not intended for integrating into git.git, but
rather this patch is written to demonstrate this breakage. I hope that
the test can be added to t6030-bisect-porcelain.sh, and make this patch
redundant.  

 t/t6031-bisect-skip.sh | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100755 t/t6031-bisect-skip.sh

diff --git a/t/t6031-bisect-skip.sh b/t/t6031-bisect-skip.sh
new file mode 100755
index 0000000000..0dfc6f0928
--- /dev/null
+++ b/t/t6031-bisect-skip.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2021 Bagas Sanjaya
+#
+
+test_description='Tests git bisect --skip'
+
+exec </dev/null
+
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+. ./test-lib.sh
+
+# hash variables
+HASH_SKIPPED_FROM=
+HASH_SKIPPED_TO=
+
+# initialize testing repo
+init() {
+	for i in `seq 1 20`; do
+		echo $i >> test &&
+		git add test && git commit -m $i
+	done
+}
+
+init
+
+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
+'
-- 
2.25.1


  parent reply	other threads:[~2021-04-20 12:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18 15:14 Using --term-* with bisect breaks skip Trygve Aaberge
2021-04-19  6:58 ` Bagas Sanjaya
2021-04-19  8:39   ` Trygve Aaberge
2021-04-19 12:50     ` Bagas Sanjaya
2021-04-19 18:55 ` Junio C Hamano
2021-04-19 19:32   ` Trygve Aaberge
2021-04-20 12:34 ` Bagas Sanjaya [this message]
2021-04-20 18:08   ` [PATCH] test: add test for git bisect skip with --term* arguments Junio C Hamano
2021-04-21  4:08 ` [PATCH v2] " Bagas Sanjaya
2021-04-21 17:25   ` Junio C Hamano
2021-04-22  5:16     ` Bagas Sanjaya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210420123435.35936-1-bagasdotme@gmail.com \
    --to=bagasdotme@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mirucam@gmail.com \
    --cc=pranit.bauva@gmail.com \
    --cc=trygveaa@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).