]> git.ipfire.org Git - thirdparty/git.git/commitdiff
treewide: convert users of `whence` to the new source field
authorPatrick Steinhardt <ps@pks.im>
Wed, 24 Jun 2026 12:19:17 +0000 (14:19 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Jun 2026 17:12:35 +0000 (10:12 -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 adc626ce30ee330fcd61f8f85e005f6f697e27fc..1b96150e5b690892256c04abf637467c0fdf8c03 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->sourcep->source->type == ODB_SOURCE_PACKED)
                return payload->callback(oid, oi->sourcep->u.packed.pack,
                                         oi->sourcep->u.packed.offset,
                                         payload->payload);
index 77af26db8fc0f34c6d985795861e20602439c7a3..1b03b07e5ecdb1de71bad7db306b40d13c20e2e3 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 && info_source.u.packed.pack->pack_promisor)
+               if (info_source.source->type == ODB_SOURCE_PACKED &&
+                   info_source.u.packed.pack->pack_promisor)
                        continue;
 
                if (!cmd.args.nr) {
index 9deb37e9e87efeeafe53b093c3e8a4d0bc8bec13..d0fdfad7504713c16b665d12673ba66128fc53dd 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 || !info_source.u.packed.pack->pack_promisor;
+       return info_source.source->type != ODB_SOURCE_PACKED || !info_source.u.packed.pack->pack_promisor;
 }
 
 static int is_not_in_promisor_pack(struct commit *commit, void *data) {
index 2fc5b82d62658b66491a8189b535f53b2c172226..123a658944b86c4d9bcb045fae3e3a1599b32f56 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->sourcep->source->type == ODB_SOURCE_PACKED)
                        data->cb(obj, oi->sourcep->u.packed.pack,
                                 oi->sourcep->u.packed.offset, *oi->mtimep);
                else