packed_object_info(): use object_id for returning delta base
If a caller sets the object_info.delta_base_sha1 to a non-NULL pointer, we'll write the oid of the object's delta base to it. But we can increase our type safety by switching this to a real object_id struct. All of our callers are just pointing into the hash member of an object_id anyway, so there's no inconvenience. Note that we do still keep it as a pointer-to-struct, because the NULL sentinel value tells us whether the caller is even interested in the information. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
63f4a7fc01
commit
b99b6bcc57
@ -1354,8 +1354,8 @@ static int loose_object_info(struct repository *r,
|
||||
struct strbuf hdrbuf = STRBUF_INIT;
|
||||
unsigned long size_scratch;
|
||||
|
||||
if (oi->delta_base_sha1)
|
||||
hashclr(oi->delta_base_sha1);
|
||||
if (oi->delta_base_oid)
|
||||
oidclr(oi->delta_base_oid);
|
||||
|
||||
/*
|
||||
* If we don't care about type or size, then we don't
|
||||
@ -1474,8 +1474,8 @@ static int do_oid_object_info_extended(struct repository *r,
|
||||
*(oi->sizep) = co->size;
|
||||
if (oi->disk_sizep)
|
||||
*(oi->disk_sizep) = 0;
|
||||
if (oi->delta_base_sha1)
|
||||
hashclr(oi->delta_base_sha1);
|
||||
if (oi->delta_base_oid)
|
||||
oidclr(oi->delta_base_oid);
|
||||
if (oi->type_name)
|
||||
strbuf_addstr(oi->type_name, type_name(co->type));
|
||||
if (oi->contentp)
|
||||
|
Reference in New Issue
Block a user