From b99b6bcc57faf5c989fc18c3b8d4d92df3407cec Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sun, 23 Feb 2020 23:36:56 -0500 Subject: 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 Signed-off-by: Junio C Hamano --- builtin/cat-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin/cat-file.c') diff --git a/builtin/cat-file.c b/builtin/cat-file.c index d6a1aa74cd..272f9fc6d7 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -262,7 +262,7 @@ static void expand_atom(struct strbuf *sb, const char *atom, int len, strbuf_addstr(sb, data->rest); } else if (is_atom("deltabase", atom, len)) { if (data->mark_query) - data->info.delta_base_sha1 = data->delta_base_oid.hash; + data->info.delta_base_oid = &data->delta_base_oid; else strbuf_addstr(sb, oid_to_hex(&data->delta_base_oid)); -- cgit v1.2.3