@@ -710,7 +710,7 @@ static int is_expected_rev(const struct object_id *oid)
static int bisect_checkout(const struct object_id *bisect_rev, int no_checkout)
{
char bisect_rev_hex[GIT_MAX_HEXSZ + 1];
-
+ int res = 0;
memcpy(bisect_rev_hex, oid_to_hex(bisect_rev), GIT_SHA1_HEXSZ + 1);
update_ref(NULL, "BISECT_EXPECTED_REV", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
@@ -719,14 +719,14 @@ static int bisect_checkout(const struct object_id *bisect_rev, int no_checkout)
update_ref(NULL, "BISECT_HEAD", bisect_rev, NULL, 0,
UPDATE_REFS_DIE_ON_ERR);
} else {
- int res;
res = run_command_v_opt(argv_checkout, RUN_GIT_CMD);
if (res)
- exit(res);
+ return res > 0 ? -res : res;
}
argv_show_branch[1] = bisect_rev_hex;
- return run_command_v_opt(argv_show_branch, RUN_GIT_CMD);
+ res = run_command_v_opt(argv_show_branch, RUN_GIT_CMD);
+ return res > 0 ? -res : res;
}
static struct commit *get_commit_reference(const struct object_id *oid)
@@ -822,7 +822,7 @@ static void check_merge_bases(int rev_nr, struct commit **rev, int no_checkout)
handle_skipped_merge_base(mb);
} else {
printf(_("Bisecting: a merge base must be tested\n"));
- exit(bisect_checkout(mb, no_checkout));
+ exit(-bisect_checkout(mb, no_checkout));
}
}