diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-12-20 21:14:54 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-12-20 21:14:54 +0300 |
commit | 67dfb897b3ea438a5a7bb29af2cd0360235e5191 (patch) | |
tree | a75698277601cbe8a50abe8c06c23669065026ab /builtin | |
parent | 9eec6a1c5fc03e5f01f200bdb28f1dc6b8e9f03e (diff) | |
parent | daaa03e54c481b4906b4b6a80d89dbb5a239e509 (diff) |
Merge branch 'jk/bisect-reset-fix'
"git bisect reset" has been taught to clean up state files and refs
even when BISECT_START file is gone.
* jk/bisect-reset-fix:
bisect: always clean on reset
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/bisect.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/builtin/bisect.c b/builtin/bisect.c index 35938b05fd..c5565686bf 100644 --- a/builtin/bisect.c +++ b/builtin/bisect.c @@ -233,11 +233,10 @@ static int bisect_reset(const char *commit) struct strbuf branch = STRBUF_INIT; if (!commit) { - if (strbuf_read_file(&branch, git_path_bisect_start(), 0) < 1) { + if (!strbuf_read_file(&branch, git_path_bisect_start(), 0)) printf(_("We are not bisecting.\n")); - return 0; - } - strbuf_rtrim(&branch); + else + strbuf_rtrim(&branch); } else { struct object_id oid; @@ -246,7 +245,7 @@ static int bisect_reset(const char *commit) strbuf_addstr(&branch, commit); } - if (!ref_exists("BISECT_HEAD")) { + if (branch.len && !ref_exists("BISECT_HEAD")) { struct child_process cmd = CHILD_PROCESS_INIT; cmd.git_cmd = 1; |