]> git.ipfire.org Git - thirdparty/git.git/commitdiff
treewide: convert users of `whence` to the new source field
authorPatrick Steinhardt <ps@pks.im>
Thu, 2 Jul 2026 12:02:02 +0000 (14:02 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Jul 2026 16:52:32 +0000 (09:52 -0700)
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>
builtin/cat-file.c
builtin/index-pack.c
builtin/pack-objects.c
reachable.c

index 0aca6acb753312c1faffe46c5ccc3ec4767c1742..758f8fc736321c22faf90946688e736832de367a 100644 (file)
@@ -834,7 +834,7 @@ static int batch_one_object_oi(const struct object_id *oid,
                               void *_payload)
 {
        struct for_each_object_payload *payload = _payload;
-       if (oi && oi->whence == OI_PACKED)
+       if (oi && oi->source_infop->source->type == ODB_SOURCE_PACKED)
                return payload->callback(oid, oi->source_infop->u.packed.pack,
                                         oi->source_infop->u.packed.offset,
                                         payload->payload);
index fe6e70522d648d3b73e74d0fef16ecd947aa67b1..7af1aea6f9f13fc020409d5ffcafdd5635cf7962 100644 (file)
@@ -1833,7 +1833,8 @@ static void repack_local_links(void)
                if (odb_read_object_info_extended(the_repository->objects, oid, &info, 0))
                        /* Missing; assume it is a promisor object */
                        continue;
-               if (info.whence == OI_PACKED && source_info.u.packed.pack->pack_promisor)
+               if (source_info.source->type == ODB_SOURCE_PACKED &&
+                   source_info.u.packed.pack->pack_promisor)
                        continue;
 
                if (!cmd.args.nr) {
index b7ef90f67c68f4df9f3b1e3d646b50a2b7ad3291..4fdb6dbf6fe8000ea8100c7ffe218663278567ac 100644 (file)
@@ -5010,7 +5010,7 @@ static int is_not_in_promisor_pack_obj(struct object *obj, void *data UNUSED)
 
        if (odb_read_object_info_extended(the_repository->objects, &obj->oid, &info, 0))
                BUG("should_include_obj should only be called on existing objects");
-       return info.whence != OI_PACKED || !source_info.u.packed.pack->pack_promisor;
+       return source_info.source->type != ODB_SOURCE_PACKED || !source_info.u.packed.pack->pack_promisor;
 }
 
 static int is_not_in_promisor_pack(struct commit *commit, void *data) {
index bf76b48fc5fff0ae23c62b45418c156d81d12303..caadacc02ad2ad2656092526386896bb738aa74f 100644 (file)
@@ -234,7 +234,7 @@ static int add_recent_object(const struct object_id *oid,
 
        add_pending_object(data->revs, obj, "");
        if (data->cb) {
-               if (oi->whence == OI_PACKED)
+               if (oi->source_infop->source->type == ODB_SOURCE_PACKED)
                        data->cb(obj, oi->source_infop->u.packed.pack,
                                 oi->source_infop->u.packed.offset, *oi->mtimep);
                else