summaryrefslogtreecommitdiff
path: root/packfile.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-02-24 04:36:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-24 20:55:53 (GMT)
commitb99b6bcc57faf5c989fc18c3b8d4d92df3407cec (patch)
tree1cc189885d98924650c5610c8e846e9b23ab45bc /packfile.c
parent63f4a7fc0107ec240f48605a4d4f8e41b91caa41 (diff)
downloadgit-b99b6bcc57faf5c989fc18c3b8d4d92df3407cec.zip
git-b99b6bcc57faf5c989fc18c3b8d4d92df3407cec.tar.gz
git-b99b6bcc57faf5c989fc18c3b8d4d92df3407cec.tar.bz2
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>
Diffstat (limited to 'packfile.c')
-rw-r--r--packfile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/packfile.c b/packfile.c
index 947c3f8..ec7349b 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1556,7 +1556,7 @@ int packed_object_info(struct repository *r, struct packed_git *p,
}
}
- if (oi->delta_base_sha1) {
+ if (oi->delta_base_oid) {
if (type == OBJ_OFS_DELTA || type == OBJ_REF_DELTA) {
const unsigned char *base;
@@ -1567,9 +1567,9 @@ int packed_object_info(struct repository *r, struct packed_git *p,
goto out;
}
- hashcpy(oi->delta_base_sha1, base);
+ hashcpy(oi->delta_base_oid->hash, base);
} else
- hashclr(oi->delta_base_sha1);
+ oidclr(oi->delta_base_oid);
}
oi->whence = in_delta_base_cache(p, obj_offset) ? OI_DBCACHED :