git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsayjones.plus.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: GIT Mailing-list <git@vger.kernel.org>,
	Bagas Sanjaya <bagasdotme@gmail.com>,
	Trygve Aaberge <trygveaa@gmail.com>
Subject: [PATCH] bisect--helper: use BISECT_TERMS in 'bisect skip' command
Date: Sun, 25 Apr 2021 01:18:27 +0100	[thread overview]
Message-ID: <fd40e12f-9649-1327-4bdb-dce5b5eed619@ramsayjones.plus.com> (raw)


Commit e4c7b33747 ("bisect--helper: reimplement `bisect_skip` shell
function in C", 2021-02-03), as part of the shell-to-C conversion,
forgot to read the 'terms' file (.git/BISECT_TERMS) during the new
'bisect skip' command implementation. As a result, the 'bisect skip'
command will use the default 'bad'/'good' terms. If the bisection
terms have been set to non-default values (for example by the
'bisect start' command), then the 'bisect skip' command will fail.

In order to correct this problem, we insert a call to the get_terms()
function, which reads the non-default terms from that file (if set),
in the '--bisect-skip' command implementation of 'bisect--helper'.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---

Hi Junio,

This patch was created directly on top of commit e4c7b33747 and tested
with the test from Bagas Sanjaya [1] (ie the second version of the
stand-alone test file t6031-*.sh, rather than the newer patch that
adds the test to t6030-*.sh). I applied this patch to the current
master branch (@311531c9de55) and it also passed the test in [1].

[I created the patch on top of e4c7b33747 so that it would, hopefully,
easily backport to the relevant 'maint' branches, should you feel the
need. ;-) ]

At this point, I would normally have looked to see if there were other
examples of forgetting to call 'get_terms()' (which seems possible).
However, I am a bit busy, so I will have to add that to my TODO list ...
:(

ATB,
Ramsay Jones

[1] https://lore.kernel.org/git/20210421040808.14185-1-bagasdotme@gmail.com/

 builtin/bisect--helper.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
index 7ad9b4d55b..49c07f0710 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect--helper.c
@@ -1129,6 +1129,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
 		break;
 	case BISECT_SKIP:
 		set_terms(&terms, "bad", "good");
+		get_terms(&terms);
 		res = bisect_skip(&terms, argv, argc);
 		break;
 	default:
-- 
2.31.0

             reply	other threads:[~2021-04-25  0:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-25  0:18 Ramsay Jones [this message]
2021-04-25  8:16 ` [PATCH] bisect--helper: use BISECT_TERMS in 'bisect skip' command Bagas Sanjaya
2021-04-26  7:06   ` Christian Couder
2021-04-28  4:09     ` 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=fd40e12f-9649-1327-4bdb-dce5b5eed619@ramsayjones.plus.com \
    --to=ramsay@ramsayjones.plus.com \
    --cc=bagasdotme@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).