]> git.ipfire.org Git - thirdparty/git.git/commitdiff
bisect: treat BISECT_HEAD as a pseudo ref
authorHan-Wen Nienhuys <hanwen@google.com>
Fri, 10 Jul 2020 17:19:52 +0000 (17:19 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Jul 2020 20:53:37 +0000 (13:53 -0700)
Both the git-bisect.sh as bisect--helper inspected the file system
directly.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/bisect--helper.c
git-bisect.sh

index ec4996282e36e2edcd4109321f83b921a24c5a32..73f9324ad7d150b3489c65edd10d52a9e309f73e 100644 (file)
@@ -13,7 +13,6 @@ static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
 static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
 static GIT_PATH_FUNC(git_path_bisect_ancestors_ok, "BISECT_ANCESTORS_OK")
 static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START")
-static GIT_PATH_FUNC(git_path_bisect_head, "BISECT_HEAD")
 static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG")
 static GIT_PATH_FUNC(git_path_head_name, "head-name")
 static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES")
@@ -164,7 +163,7 @@ static int bisect_reset(const char *commit)
                strbuf_addstr(&branch, commit);
        }
 
-       if (!file_exists(git_path_bisect_head())) {
+       if (!ref_exists("BISECT_HEAD")) {
                struct argv_array argv = ARGV_ARRAY_INIT;
 
                argv_array_pushl(&argv, "checkout", branch.buf, "--", NULL);
index 08a6ed57ddb115413013ce5cd4c9a786b1a2bef9..f03fbb18f00403b2786f5b4cb1b18e30b1e820b2 100755 (executable)
@@ -41,7 +41,7 @@ TERM_GOOD=good
 
 bisect_head()
 {
-       if test -f "$GIT_DIR/BISECT_HEAD"
+       if git rev-parse --verify -q BISECT_HEAD > /dev/null
        then
                echo BISECT_HEAD
        else
@@ -153,7 +153,7 @@ bisect_next() {
        git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD $TERM_GOOD|| exit
 
        # Perform all bisection computation, display and checkout
-       git bisect--helper --next-all $(test -f "$GIT_DIR/BISECT_HEAD" && echo --no-checkout)
+       git bisect--helper --next-all $(git rev-parse --verify -q BISECT_HEAD > /dev/null && echo --no-checkout)
        res=$?
 
        # Check if we should exit because bisection is finished