treewide: convert users of `whence` to the new source field

The `whence` field has become redundant now that callers can learn about the exact source an object has been looked up from via the `struct object_info_source::source` field. Adapt callers to use the new field. Note that all callsites already set up the `info.sourcep` request pointer, so the conversion is rather straight-forward. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Jul 2, 2026 at 14:02 UTC 2242f7ee36e9ec1a70314b685b1680e641e56f88
4 files changed +5 -4
builtin/cat-file.c
+1 -1
@@ -834,7 +834,7 @@ static int batch_one_object_oi(const struct object_id *oid,
834 void *_payload)
835 {
836 struct for_each_object_payload *payload = _payload;
837 - if (oi && oi->whence == OI_PACKED)
837 + if (oi && oi->source_infop->source->type == ODB_SOURCE_PACKED)
838 return payload->callback(oid, oi->source_infop->u.packed.pack,
839 oi->source_infop->u.packed.offset,
840 payload->payload);
builtin/index-pack.c
+2 -1
@@ -1833,7 +1833,8 @@ static void repack_local_links(void)
1833 if (odb_read_object_info_extended(the_repository->objects, oid, &info, 0))
1834 /* Missing; assume it is a promisor object */
1835 continue;
1836 - if (info.whence == OI_PACKED && source_info.u.packed.pack->pack_promisor)
1836 + if (source_info.source->type == ODB_SOURCE_PACKED &&
1837 + source_info.u.packed.pack->pack_promisor)
1838 continue;
1839
1840 if (!cmd.args.nr) {
builtin/pack-objects.c
+1 -1
@@ -5010,7 +5010,7 @@ static int is_not_in_promisor_pack_obj(struct object *obj, void *data UNUSED)
5010
5011 if (odb_read_object_info_extended(the_repository->objects, &obj->oid, &info, 0))
5012 BUG("should_include_obj should only be called on existing objects");
5013 - return info.whence != OI_PACKED || !source_info.u.packed.pack->pack_promisor;
5013 + return source_info.source->type != ODB_SOURCE_PACKED || !source_info.u.packed.pack->pack_promisor;
5014 }
5015
5016 static int is_not_in_promisor_pack(struct commit *commit, void *data) {
reachable.c
+1 -1
@@ -234,7 +234,7 @@ static int add_recent_object(const struct object_id *oid,
234
235 add_pending_object(data->revs, obj, "");
236 if (data->cb) {
237 - if (oi->whence == OI_PACKED)
237 + if (oi->source_infop->source->type == ODB_SOURCE_PACKED)
238 data->cb(obj, oi->source_infop->u.packed.pack,
239 oi->source_infop->u.packed.offset, *oi->mtimep);
240 else