Skip to content

Commit 5b476dc

Browse files
committed
Merge branch 'js/bisect-helper-check-get-oid-return-value'
Code cleanup. * js/bisect-helper-check-get-oid-return-value: bisect--helper: verify HEAD could be parsed before continuing
2 parents 9b3897a + 7877ac3 commit 5b476dc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

builtin/bisect--helper.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,10 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout,
570570
write_file(git_path_bisect_start(), "%s\n", start_head.buf);
571571

572572
if (no_checkout) {
573-
get_oid(start_head.buf, &oid);
573+
if (get_oid(start_head.buf, &oid) < 0) {
574+
retval = error(_("invalid ref: '%s'"), start_head.buf);
575+
goto finish;
576+
}
574577
if (update_ref(NULL, "BISECT_HEAD", &oid, NULL, 0,
575578
UPDATE_REFS_MSG_ON_ERR)) {
576579
retval = -1;

0 commit comments

Comments
 (0)