bisect: convert bisect_checkout to struct object_id
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
a0bb553542
commit
4be0deecbe
18
bisect.c
18
bisect.c
@ -680,16 +680,16 @@ static int is_expected_rev(const struct object_id *oid)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bisect_checkout(const unsigned char *bisect_rev, int no_checkout)
|
static int bisect_checkout(const struct object_id *bisect_rev, int no_checkout)
|
||||||
{
|
{
|
||||||
char bisect_rev_hex[GIT_MAX_HEXSZ + 1];
|
char bisect_rev_hex[GIT_MAX_HEXSZ + 1];
|
||||||
|
|
||||||
memcpy(bisect_rev_hex, sha1_to_hex(bisect_rev), GIT_SHA1_HEXSZ + 1);
|
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);
|
update_ref(NULL, "BISECT_EXPECTED_REV", bisect_rev->hash, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
|
||||||
|
|
||||||
argv_checkout[2] = bisect_rev_hex;
|
argv_checkout[2] = bisect_rev_hex;
|
||||||
if (no_checkout) {
|
if (no_checkout) {
|
||||||
update_ref(NULL, "BISECT_HEAD", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
|
update_ref(NULL, "BISECT_HEAD", bisect_rev->hash, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
|
||||||
} else {
|
} else {
|
||||||
int res;
|
int res;
|
||||||
res = run_command_v_opt(argv_checkout, RUN_GIT_CMD);
|
res = run_command_v_opt(argv_checkout, RUN_GIT_CMD);
|
||||||
@ -796,7 +796,7 @@ static void check_merge_bases(int no_checkout)
|
|||||||
handle_skipped_merge_base(mb);
|
handle_skipped_merge_base(mb);
|
||||||
} else {
|
} else {
|
||||||
printf(_("Bisecting: a merge base must be tested\n"));
|
printf(_("Bisecting: a merge base must be tested\n"));
|
||||||
exit(bisect_checkout(mb->hash, no_checkout));
|
exit(bisect_checkout(mb, no_checkout));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -939,7 +939,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
|
|||||||
struct rev_info revs;
|
struct rev_info revs;
|
||||||
struct commit_list *tried;
|
struct commit_list *tried;
|
||||||
int reaches = 0, all = 0, nr, steps;
|
int reaches = 0, all = 0, nr, steps;
|
||||||
const unsigned char *bisect_rev;
|
struct object_id *bisect_rev;
|
||||||
char *steps_msg;
|
char *steps_msg;
|
||||||
|
|
||||||
read_bisect_terms(&term_bad, &term_good);
|
read_bisect_terms(&term_bad, &term_good);
|
||||||
@ -977,11 +977,11 @@ int bisect_next_all(const char *prefix, int no_checkout)
|
|||||||
exit(4);
|
exit(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bisect_rev = revs.commits->item->object.oid.hash;
|
bisect_rev = &revs.commits->item->object.oid;
|
||||||
|
|
||||||
if (!hashcmp(bisect_rev, current_bad_oid->hash)) {
|
if (!oidcmp(bisect_rev, current_bad_oid)) {
|
||||||
exit_if_skipped_commits(tried, current_bad_oid);
|
exit_if_skipped_commits(tried, current_bad_oid);
|
||||||
printf("%s is the first %s commit\n", sha1_to_hex(bisect_rev),
|
printf("%s is the first %s commit\n", oid_to_hex(bisect_rev),
|
||||||
term_bad);
|
term_bad);
|
||||||
show_diff_tree(prefix, revs.commits->item);
|
show_diff_tree(prefix, revs.commits->item);
|
||||||
/* This means the bisection process succeeded. */
|
/* This means the bisection process succeeded. */
|
||||||
|
Reference in New Issue
Block a user