Skip to content

Commit de966e3

Browse files
hanwengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ce57d85 commit de966e3

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

builtin/bisect--helper.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
1313
static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
1414
static GIT_PATH_FUNC(git_path_bisect_ancestors_ok, "BISECT_ANCESTORS_OK")
1515
static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START")
16-
static GIT_PATH_FUNC(git_path_bisect_head, "BISECT_HEAD")
1716
static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG")
1817
static GIT_PATH_FUNC(git_path_head_name, "head-name")
1918
static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES")
@@ -164,7 +163,7 @@ static int bisect_reset(const char *commit)
164163
strbuf_addstr(&branch, commit);
165164
}
166165

167-
if (!file_exists(git_path_bisect_head())) {
166+
if (!ref_exists("BISECT_HEAD")) {
168167
struct argv_array argv = ARGV_ARRAY_INIT;
169168

170169
argv_array_pushl(&argv, "checkout", branch.buf, "--", NULL);

git-bisect.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ TERM_GOOD=good
4141

4242
bisect_head()
4343
{
44-
if test -f "$GIT_DIR/BISECT_HEAD"
44+
if git rev-parse --verify -q BISECT_HEAD > /dev/null
4545
then
4646
echo BISECT_HEAD
4747
else
@@ -153,7 +153,7 @@ bisect_next() {
153153
git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD $TERM_GOOD|| exit
154154

155155
# 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)
157157
res=$?
158158

159159
# Check if we should exit because bisection is finished

0 commit comments

Comments
 (0)