[PATCH 24/32] builtin/pack-objects: Communicate the compatibility hash through struct pack_idx_entry
- From
Eric W. Biederman <ebiederm@xmission.com>
- Date
- Sep 8, 2023, 23:10 UTC
- Message-ID
- <20230908231049.2035003-24-ebiederm@xmission.com>
- In-Reply-To
- <87sf7ol0z3.fsf@email.froward.int.ebiederm.org>
When pack-objects is run all objects in the repository should already have a compatibilty hash computed so it is just necessary to read the existing mappings and store the value in struct pack_idx_entry.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> --- builtin/pack-objects.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index d34902002656..ff04660a18fd 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -42,6 +42,7 @@ #include "promisor-remote.h" #include "pack-mtimes.h" #include "parse-options.h" +#include "object-file-convert.h" /* * Objects we are going to pack are collected in the `to_pack` structure. @@ -1547,10 +1548,16 @@ static struct object_entry *create_object_entry(const struct object_id *oid, struct packed_git *found_pack, off_t found_offset) { + struct repository *repo = the_repository; + const struct git_hash_algo *compat = repo->compat_hash_algo; struct object_entry *entry; entry = packlist_alloc(&to_pack, oid); entry->hash = hash; + if (compat && + repo_oid_to_algop(repo, &entry->idx.oid, compat, + &entry->idx.compat_oid)) + die(_("can't map object %s while writing pack"), oid_to_hex(oid)); oe_set_type(entry, type); if (exclude) entry->preferred_base = 1;
-- 2.41.0