]> git.ipfire.org Git - thirdparty/git.git/commitdiff
packfile: always declare object info to be OI_PACKED
authorPatrick Steinhardt <ps@pks.im>
Wed, 7 Jan 2026 13:08:01 +0000 (14:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Jan 2026 02:04:22 +0000 (11:04 +0900)
When reading object info via a packfile we yield one of two types:

  - The object can either be OI_PACKED, which is what a caller would
    typically expect.

  - Or it can be OI_DBCACHED if it is stored in the delta base cache.

The latter really is an implementation detail though, and callers
typically don't care at all about the difference. Furthermore, the
information whether or not it is part of the delta base cache can
already be derived via the `is_delta` field, so the fact that we discern
between OI_PACKED and OI_DBCACHED only further complicates the
interface.

There aren't all that many callers that care about the `whence` field in
the first place. In fact, there's only three:

  - `packfile_store_read_object_info()` checks for `whence == OI_PACKED`
    and then populates the packfile information of the object info
    structure. We now start to do this also for deltified objects, which
    gives its callers strictly more information.

  - `repack_local_links()` wants to determine whether the object is part
    of a promisor pack and checks for `whence == OI_PACKED`. If so, it
    verifies that the packfile is a promisor pack. It's arguably wrong
    to declare that an object is not part of a promisor pack only
    because it is stored in the delta base cache.

  - `is_not_in_promisor_pack_obj()` does the same, but checks that a
    specific object is _not_ part of a promisor pack. The same reasoning
    as above applies.

Drop the OI_DBCACHED enum completely. None of the callers seem to care
about the distinction.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
odb.h
packfile.c

diff --git a/odb.h b/odb.h
index 014cd9585a2f6efe7367e300afd465906f4a1e3a..73b0b87ad55cf28462f78232d213c528675abd13 100644 (file)
--- a/odb.h
+++ b/odb.h
@@ -330,7 +330,6 @@ struct object_info {
                OI_CACHED,
                OI_LOOSE,
                OI_PACKED,
-               OI_DBCACHED
        } whence;
        union {
                /*
index 08a0863fc3374c982029d50116f6018e4fcdde92..b0c6665c878d9e1112472051f2a325f77bceb44c 100644 (file)
@@ -1656,8 +1656,7 @@ int packed_object_info(struct repository *r, struct packed_git *p,
                        oidclr(oi->delta_base_oid, p->repo->hash_algo);
        }
 
-       oi->whence = in_delta_base_cache(p, obj_offset) ? OI_DBCACHED :
-                                                         OI_PACKED;
+       oi->whence = OI_PACKED;
 
 out:
        unuse_pack(&w_curs);