sha1_file: convert sha1_object_info* to object_id

Convert sha1_object_info and sha1_object_info_extended to take pointers
to struct object_id and rename them to use "oid" instead of "sha1" in
their names.  Update the declaration and definition and apply the
following semantic patch, plus the standard object_id transforms:

@@
expression E1, E2;
@@
- sha1_object_info(E1.hash, E2)
+ oid_object_info(&E1, E2)

@@
expression E1, E2;
@@
- sha1_object_info(E1->hash, E2)
+ oid_object_info(E1, E2)

@@
expression E1, E2, E3;
@@
- sha1_object_info_extended(E1.hash, E2, E3)
+ oid_object_info_extended(&E1, E2, E3)

@@
expression E1, E2, E3;
@@
- sha1_object_info_extended(E1->hash, E2, E3)
+ oid_object_info_extended(E1, E2, E3)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson
2018-03-12 02:27:46 +00:00
committed by Junio C Hamano
parent 7984f23833
commit abef9020e3
33 changed files with 71 additions and 72 deletions

View File

@ -1516,7 +1516,7 @@ static void check_object(struct object_entry *entry)
unuse_pack(&w_curs);
}
entry->type = sha1_object_info(entry->idx.oid.hash, &entry->size);
entry->type = oid_object_info(&entry->idx.oid, &entry->size);
/*
* The error condition is checked in prepare_pack(). This is
* to permit a missing preferred base object to be ignored
@ -1578,8 +1578,7 @@ static void drop_reused_delta(struct object_entry *entry)
* And if that fails, the error will be recorded in entry->type
* and dealt with in prepare_pack().
*/
entry->type = sha1_object_info(entry->idx.oid.hash,
&entry->size);
entry->type = oid_object_info(&entry->idx.oid, &entry->size);
}
}
@ -2708,7 +2707,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
static int add_loose_object(const struct object_id *oid, const char *path,
void *data)
{
enum object_type type = sha1_object_info(oid->hash, NULL);
enum object_type type = oid_object_info(oid, NULL);
if (type < 0) {
warning("loose object at %s could not be examined", path);