There are a very small number of callers which don't already use struct object_id. Convert them. Signed-off-by: brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx> --- bisect.c | 14 +++++++------- builtin/pack-objects.c | 16 ++++++++-------- ref-filter.c | 22 +++++++++++----------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/bisect.c b/bisect.c index 886e630884..a25d008693 100644 --- a/bisect.c +++ b/bisect.c @@ -754,9 +754,9 @@ static void handle_bad_merge_base(void) exit(1); } -static void handle_skipped_merge_base(const unsigned char *mb) +static void handle_skipped_merge_base(const struct object_id *mb) { - char *mb_hex = sha1_to_hex(mb); + char *mb_hex = oid_to_hex(mb); char *bad_hex = oid_to_hex(current_bad_oid); char *good_hex = join_sha1_array_hex(&good_revs, ' '); @@ -787,16 +787,16 @@ static void check_merge_bases(int no_checkout) result = get_merge_bases_many(rev[0], rev_nr - 1, rev + 1); for (; result; result = result->next) { - const unsigned char *mb = result->item->object.oid.hash; - if (!hashcmp(mb, current_bad_oid->hash)) { + const struct object_id *mb = &result->item->object.oid; + if (!oidcmp(mb, current_bad_oid)) { handle_bad_merge_base(); - } else if (0 <= sha1_array_lookup(&good_revs, mb)) { + } else if (0 <= sha1_array_lookup(&good_revs, mb->hash)) { continue; - } else if (0 <= sha1_array_lookup(&skipped_revs, mb)) { + } else if (0 <= sha1_array_lookup(&skipped_revs, mb->hash)) { 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->hash, no_checkout)); } } diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index dfeacd5c37..dca1b68e69 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -2670,14 +2670,14 @@ static int has_sha1_pack_kept_or_nonlocal(const unsigned char *sha1) */ static struct sha1_array recent_objects; -static int loosened_object_can_be_discarded(const unsigned char *sha1, +static int loosened_object_can_be_discarded(const struct object_id *oid, unsigned long mtime) { if (!unpack_unreachable_expiration) return 0; if (mtime > unpack_unreachable_expiration) return 0; - if (sha1_array_lookup(&recent_objects, sha1) >= 0) + if (sha1_array_lookup(&recent_objects, oid->hash) >= 0) return 0; return 1; } @@ -2686,7 +2686,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs) { struct packed_git *p; uint32_t i; - const unsigned char *sha1; + struct object_id oid; for (p = packed_git; p; p = p->next) { if (!p->pack_local || p->pack_keep) @@ -2696,11 +2696,11 @@ static void loosen_unused_packed_objects(struct rev_info *revs) die("cannot open pack index"); for (i = 0; i < p->num_objects; i++) { - sha1 = nth_packed_object_sha1(p, i); - if (!packlist_find(&to_pack, sha1, NULL) && - !has_sha1_pack_kept_or_nonlocal(sha1) && - !loosened_object_can_be_discarded(sha1, p->mtime)) - if (force_object_loose(sha1, p->mtime)) + nth_packed_object_oid(&oid, p, i); + if (!packlist_find(&to_pack, oid.hash, NULL) && + !has_sha1_pack_kept_or_nonlocal(oid.hash) && + !loosened_object_can_be_discarded(&oid, p->mtime)) + if (force_object_loose(oid.hash, p->mtime)) die("unable to force loose object"); } } diff --git a/ref-filter.c b/ref-filter.c index 9c82b5b9d6..d3dcb53dd5 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1677,22 +1677,22 @@ static int filter_pattern_match(struct ref_filter *filter, const char *refname) * the need to parse the object via parse_object(). peel_ref() might be a * more efficient alternative to obtain the pointee. */ -static const unsigned char *match_points_at(struct sha1_array *points_at, - const unsigned char *sha1, - const char *refname) +static const struct object_id *match_points_at(struct sha1_array *points_at, + const struct object_id *oid, + const char *refname) { - const unsigned char *tagged_sha1 = NULL; + const struct object_id *tagged_oid = NULL; struct object *obj; - if (sha1_array_lookup(points_at, sha1) >= 0) - return sha1; - obj = parse_object(sha1); + if (sha1_array_lookup(points_at, oid->hash) >= 0) + return oid; + obj = parse_object(oid->hash); if (!obj) die(_("malformed object at '%s'"), refname); if (obj->type == OBJ_TAG) - tagged_sha1 = ((struct tag *)obj)->tagged->oid.hash; - if (tagged_sha1 && sha1_array_lookup(points_at, tagged_sha1) >= 0) - return tagged_sha1; + tagged_oid = &((struct tag *)obj)->tagged->oid; + if (tagged_oid && sha1_array_lookup(points_at, tagged_oid->hash) >= 0) + return tagged_oid; return NULL; } @@ -1772,7 +1772,7 @@ static int ref_filter_handler(const char *refname, const struct object_id *oid, if (!filter_pattern_match(filter, refname)) return 0; - if (filter->points_at.nr && !match_points_at(&filter->points_at, oid->hash, refname)) + if (filter->points_at.nr && !match_points_at(&filter->points_at, oid, refname)) return 0; /*