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>
brian m. carlson committed
Jul 13, 2017 at 23:49 UTC
4be0deecbeb2c47500f8d53a6e79437d34ab8036
1 file changed
+9
-9
bisect.c
+9
-9
@@ -680,16 +680,16 @@ static int is_expected_rev(const struct object_id *oid)
680
return res;
681
}
682
683
-static int bisect_checkout(const unsigned char *bisect_rev, int no_checkout)
683
+static int bisect_checkout(const struct object_id *bisect_rev, int no_checkout)
684
{
685
char bisect_rev_hex[GIT_MAX_HEXSZ + 1];
686
687
- memcpy(bisect_rev_hex, sha1_to_hex(bisect_rev), GIT_SHA1_HEXSZ + 1);
688
- update_ref(NULL, "BISECT_EXPECTED_REV", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
687
+ memcpy(bisect_rev_hex, oid_to_hex(bisect_rev), GIT_SHA1_HEXSZ + 1);
688
+ update_ref(NULL, "BISECT_EXPECTED_REV", bisect_rev->hash, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
689
690
argv_checkout[2] = bisect_rev_hex;
691
if (no_checkout) {
692
- update_ref(NULL, "BISECT_HEAD", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
692
+ update_ref(NULL, "BISECT_HEAD", bisect_rev->hash, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
693
} else {
694
int res;
695
res = run_command_v_opt(argv_checkout, RUN_GIT_CMD);
@@ -796,7 +796,7 @@ static void check_merge_bases(int no_checkout)
796
handle_skipped_merge_base(mb);
797
} else {
798
printf(_("Bisecting: a merge base must be tested\n"));
799
- exit(bisect_checkout(mb->hash, no_checkout));
799
+ exit(bisect_checkout(mb, no_checkout));
800
}
801
}
802
@@ -939,7 +939,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
939
struct rev_info revs;
940
struct commit_list *tried;
941
int reaches = 0, all = 0, nr, steps;
942
- const unsigned char *bisect_rev;
942
+ struct object_id *bisect_rev;
943
char *steps_msg;
944
945
read_bisect_terms(&term_bad, &term_good);
@@ -977,11 +977,11 @@ int bisect_next_all(const char *prefix, int no_checkout)
977
exit(4);
978
}
979
980
- bisect_rev = revs.commits->item->object.oid.hash;
980
+ bisect_rev = &revs.commits->item->object.oid;
981
982
- if (!hashcmp(bisect_rev, current_bad_oid->hash)) {
982
+ if (!oidcmp(bisect_rev, current_bad_oid)) {
983
exit_if_skipped_commits(tried, current_bad_oid);
984
- printf("%s is the first %s commit\n", sha1_to_hex(bisect_rev),
984
+ printf("%s is the first %s commit\n", oid_to_hex(bisect_rev),
985
term_bad);
986
show_diff_tree(prefix, revs.commits->item);
987
/* This means the bisection process succeeded. */