while (list) {
struct commit_list *next = list->next;
list->next = NULL;
- if (0 <= sha1_array_lookup(&skipped_revs,
- list->item->object.oid.hash)) {
+ if (0 <= sha1_array_lookup(&skipped_revs, &list->item->object.oid)) {
if (skipped_first && !*skipped_first)
*skipped_first = 1;
/* Move current to tried list */
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->hash)) {
+ } else if (0 <= sha1_array_lookup(&good_revs, mb)) {
continue;
- } else if (0 <= sha1_array_lookup(&skipped_revs, mb->hash)) {
+ } else if (0 <= sha1_array_lookup(&skipped_revs, mb)) {
handle_skipped_merge_base(mb);
} else {
printf(_("Bisecting: a merge base must be tested\n"));
return 0;
if (mtime > unpack_unreachable_expiration)
return 0;
- if (sha1_array_lookup(&recent_objects, oid->hash) >= 0)
+ if (sha1_array_lookup(&recent_objects, oid) >= 0)
return 0;
return 1;
}
return 0;
if (options->skiplist && object &&
- sha1_array_lookup(options->skiplist, object->oid.hash) >= 0)
+ sha1_array_lookup(options->skiplist, &object->oid) >= 0)
return 0;
if (msg_type == FSCK_FATAL)
const struct object_id *tagged_oid = NULL;
struct object *obj;
- if (sha1_array_lookup(points_at, oid->hash) >= 0)
+ if (sha1_array_lookup(points_at, oid) >= 0)
return oid;
obj = parse_object(oid->hash);
if (!obj)
die(_("malformed object at '%s'"), refname);
if (obj->type == OBJ_TAG)
tagged_oid = &((struct tag *)obj)->tagged->oid;
- if (tagged_oid && sha1_array_lookup(points_at, tagged_oid->hash) >= 0)
+ if (tagged_oid && sha1_array_lookup(points_at, tagged_oid) >= 0)
return tagged_oid;
return NULL;
}
return array[index].hash;
}
-int sha1_array_lookup(struct sha1_array *array, const unsigned char *sha1)
+int sha1_array_lookup(struct sha1_array *array, const struct object_id *oid)
{
if (!array->sorted)
sha1_array_sort(array);
- return sha1_pos(sha1, array->oid, array->nr, sha1_access);
+ return sha1_pos(oid->hash, array->oid, array->nr, sha1_access);
}
void sha1_array_clear(struct sha1_array *array)
#define SHA1_ARRAY_INIT { NULL, 0, 0, 0 }
void sha1_array_append(struct sha1_array *array, const struct object_id *oid);
-int sha1_array_lookup(struct sha1_array *array, const unsigned char *sha1);
+int sha1_array_lookup(struct sha1_array *array, const struct object_id *oid);
void sha1_array_clear(struct sha1_array *array);
typedef int (*for_each_sha1_fn)(const unsigned char sha1[20],
} else if (skip_prefix(line.buf, "lookup ", &arg)) {
if (get_oid_hex(arg, &oid))
die("not a hexadecimal SHA1: %s", arg);
- printf("%d\n", sha1_array_lookup(&array, oid.hash));
+ printf("%d\n", sha1_array_lookup(&array, &oid));
} else if (!strcmp(line.buf, "clear"))
sha1_array_clear(&array);
else if (!strcmp(line.buf, "for_each_unique"))