Merge branch 'sb/oid-object-info'

The codepath around object-info API has been taught to take the
repository object (which in turn tells the API which object store
the objects are to be located).

* sb/oid-object-info:
  cache.h: allow oid_object_info to handle arbitrary repositories
  packfile: add repository argument to cache_or_unpack_entry
  packfile: add repository argument to unpack_entry
  packfile: add repository argument to read_object
  packfile: add repository argument to packed_object_info
  packfile: add repository argument to packed_to_object_type
  packfile: add repository argument to retry_bad_packed_offset
  cache.h: add repository argument to oid_object_info
  cache.h: add repository argument to oid_object_info_extended
This commit is contained in:
Junio C Hamano
2018-05-23 14:38:16 +09:00
36 changed files with 125 additions and 94 deletions

View File

@ -1521,7 +1521,8 @@ static void check_object(struct object_entry *entry)
unuse_pack(&w_curs);
}
entry->type = oid_object_info(&entry->idx.oid, &entry->size);
entry->type = oid_object_info(the_repository, &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
@ -1576,14 +1577,16 @@ static void drop_reused_delta(struct object_entry *entry)
oi.sizep = &entry->size;
oi.typep = &entry->type;
if (packed_object_info(entry->in_pack, entry->in_pack_offset, &oi) < 0) {
if (packed_object_info(the_repository, entry->in_pack,
entry->in_pack_offset, &oi) < 0) {
/*
* We failed to get the info from this pack for some reason;
* fall back to sha1_object_info, which may find another copy.
* And if that fails, the error will be recorded in entry->type
* and dealt with in prepare_pack().
*/
entry->type = oid_object_info(&entry->idx.oid, &entry->size);
entry->type = oid_object_info(the_repository, &entry->idx.oid,
&entry->size);
}
}
@ -2717,7 +2720,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 = oid_object_info(oid, NULL);
enum object_type type = oid_object_info(the_repository, oid, NULL);
if (type < 0) {
warning("loose object at %s could not be examined", path);