Skip to content

Commit

Permalink
pack-objects: refactor to oid_object_info_extended
Browse files Browse the repository at this point in the history
Use oid_object_info_extended() instead of oid_object_info() because a
subsequent commit needs to specify an additional flag here.

Signed-off-by: Jonathan Tan <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
jonathantanmy authored and gitster committed Jul 21, 2020
1 parent cfa7ae8 commit 8d5cf95
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions builtin/pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,8 @@ static int can_reuse_delta(const struct object_id *base_oid,
static void check_object(struct object_entry *entry)
{
unsigned long canonical_size;
enum object_type type;
struct object_info oi = {.typep = &type, .sizep = &canonical_size};

if (IN_PACK(entry)) {
struct packed_git *p = IN_PACK(entry);
Expand Down Expand Up @@ -1840,8 +1842,10 @@ static void check_object(struct object_entry *entry)
unuse_pack(&w_curs);
}

oe_set_type(entry,
oid_object_info(the_repository, &entry->idx.oid, &canonical_size));
if (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,
OBJECT_INFO_LOOKUP_REPLACE) < 0)
type = -1;
oe_set_type(entry, type);
if (entry->type_valid) {
SET_SIZE(entry, canonical_size);
} else {
Expand Down

0 comments on commit 8d5cf95

Please sign in to comment.