bisect: treat BISECT_HEAD as a pseudo ref
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>
Han-Wen Nienhuys committed
Jul 10, 2020 at 17:19 UTC
de966e39a8ba585e6cb0483c49e562c2f6eb3f77
2 files changed
+3
-4
builtin/bisect--helper.c
+1
-2
@@ -13,7 +13,6 @@ static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
13
static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
14
static GIT_PATH_FUNC(git_path_bisect_ancestors_ok, "BISECT_ANCESTORS_OK")
15
static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START")
16
-static GIT_PATH_FUNC(git_path_bisect_head, "BISECT_HEAD")
16
static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG")
17
static GIT_PATH_FUNC(git_path_head_name, "head-name")
18
static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES")
@@ -164,7 +163,7 @@ static int bisect_reset(const char *commit)
163
strbuf_addstr(&branch, commit);
164
}
165
167
- if (!file_exists(git_path_bisect_head())) {
166
+ if (!ref_exists("BISECT_HEAD")) {
167
struct argv_array argv = ARGV_ARRAY_INIT;
168
169
argv_array_pushl(&argv, "checkout", branch.buf, "--", NULL);
git-bisect.sh
+2
-2
@@ -41,7 +41,7 @@ TERM_GOOD=good
41
42
bisect_head()
43
{
44
- if test -f "$GIT_DIR/BISECT_HEAD"
44
+ if git rev-parse --verify -q BISECT_HEAD > /dev/null
45
then
46
echo BISECT_HEAD
47
else
@@ -153,7 +153,7 @@ bisect_next() {
153
git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD $TERM_GOOD|| exit
154
155
# Perform all bisection computation, display and checkout
156
- git bisect--helper --next-all $(test -f "$GIT_DIR/BISECT_HEAD" && echo --no-checkout)
156
+ git bisect--helper --next-all $(git rev-parse --verify -q BISECT_HEAD > /dev/null && echo --no-checkout)
157
res=$?
158
159
# Check if we should exit because bisection is finished