Re: [PATCH 03/20] write_reused_pack_one(): convert to new revindex API
From: Taylor Blau <hidden>
Date: 2021-01-12 16:35:05
Subsystem:
the rest · Maintainer:
Linus Torvalds
On Tue, Jan 12, 2021 at 03:50:05AM -0500, Jeff King wrote:
quoted
@@ -887,11 +887,15 @@ static void write_reused_pack_one(size_t pos, struct hashfile *out, /* Convert to REF_DELTA if we must... */ if (!allow_ofs_delta) { - int base_pos = find_revindex_position(reuse_packfile, base_offset); + uint32_t base_pos; struct object_id base_oid; + if (offset_to_pack_pos(reuse_packfile, base_offset, &base_pos) < 0) + die(_("expected object at offset %"PRIuMAX), + (uintmax_t)base_offset);This error does mention the offset, which is good. But not the pack name (nor the object name, but we don't have it!).
Indeed we don't have the object name, but the pack is reuse_packfile (which is statistically initialized), so we could do something like:
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 10a16ced1e..8e40b19ee8 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c@@ -893,8 +893,10 @@ static void write_reused_pack_one(size_t pos, struct hashfile *out, struct object_id base_oid; if (offset_to_pack_pos(reuse_packfile, base_offset, &base_pos) < 0) - die(_("expected object at offset %"PRIuMAX), - (uintmax_t)base_offset); + die(_("expected object at offset %"PRIuMAX" " + "in pack %s"), + (uintmax_t)base_offset, + reuse_packfile->pack_name); nth_packed_object_id(&base_oid, reuse_packfile, pack_pos_to_index(reuse_packfile, base_pos));
Which I think would be clearer.
-Peff
Thanks, Taylor