]> git.ipfire.org Git - thirdparty/git.git/commitdiff
odb: drop deprecated wrapper functions
authorPatrick Steinhardt <ps@pks.im>
Wed, 10 Sep 2025 13:12:17 +0000 (15:12 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Sep 2025 16:10:28 +0000 (09:10 -0700)
In the Git 2.51 release cycle we've refactored the object database layer
to access objects via `struct object_database` directly. To make the
transition a bit easier we have retained some of the old-style functions
in case those were widely used.

Now that Git 2.51 has been released it's time to clean up though and
drop these old wrappers. Do so and adapt the small number of newly added
users to use the new functions instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c
odb.h
t/helper/test-pack-deltas.c

index 53a225625039eae43a0d5aef6538f13b2a40d6de..ff6900b6545a248f98bce88fa2fb1f11846fc2dc 100644 (file)
@@ -3774,7 +3774,7 @@ static void show_object_pack_hint(struct object *object, const char *name,
        enum stdin_packs_mode mode = *(enum stdin_packs_mode *)data;
        if (mode == STDIN_PACKS_MODE_FOLLOW) {
                if (object->type == OBJ_BLOB &&
-                   !has_object(the_repository, &object->oid, 0))
+                   !odb_has_object(the_repository->objects, &object->oid, 0))
                        return;
                add_object_entry(&object->oid, object->type, name, 0);
        } else {
@@ -4591,8 +4591,8 @@ static int add_objects_by_path(const char *path,
 
                /* Skip objects that do not exist locally. */
                if ((exclude_promisor_objects || arg_missing_action != MA_ERROR) &&
-                   oid_object_info_extended(the_repository, oid, &oi,
-                                            OBJECT_INFO_FOR_PREFETCH) < 0)
+                   odb_read_object_info_extended(the_repository->objects, oid, &oi,
+                                                 OBJECT_INFO_FOR_PREFETCH) < 0)
                        continue;
 
                exclude = is_oid_uninteresting(the_repository, oid);
diff --git a/odb.h b/odb.h
index 3dfc66d75a3d20dd64d787d04e3ab4e5f9010e8a..e8b9dff9480ded246cc7c0f2a07ddbe28202452b 100644 (file)
--- a/odb.h
+++ b/odb.h
@@ -475,37 +475,4 @@ static inline int odb_write_object(struct object_database *odb,
        return odb_write_object_ext(odb, buf, len, type, oid, NULL, 0);
 }
 
-/* Compatibility wrappers, to be removed once Git 2.51 has been released. */
-#include "repository.h"
-
-static inline int oid_object_info_extended(struct repository *r,
-                                          const struct object_id *oid,
-                                          struct object_info *oi,
-                                          unsigned flags)
-{
-       return odb_read_object_info_extended(r->objects, oid, oi, flags);
-}
-
-static inline int oid_object_info(struct repository *r,
-                                 const struct object_id *oid,
-                                 unsigned long *sizep)
-{
-       return odb_read_object_info(r->objects, oid, sizep);
-}
-
-static inline void *repo_read_object_file(struct repository *r,
-                                         const struct object_id *oid,
-                                         enum object_type *type,
-                                         unsigned long *size)
-{
-       return odb_read_object(r->objects, oid, type, size);
-}
-
-static inline int has_object(struct repository *r,
-                            const struct object_id *oid,
-                            unsigned flags)
-{
-       return odb_has_object(r->objects, oid, flags);
-}
-
 #endif /* ODB_H */
index 4caa024b1ebe7314d778e4cfe77017c1383ca32b..4981401eaa6664981445e212a423775fe7cd0256 100644 (file)
@@ -51,16 +51,14 @@ static void write_ref_delta(struct hashfile *f,
        unsigned long size, base_size, delta_size, compressed_size, hdrlen;
        enum object_type type;
        void *base_buf, *delta_buf;
-       void *buf = repo_read_object_file(the_repository,
-                                         oid, &type,
-                                         &size);
+       void *buf = odb_read_object(the_repository->objects,
+                                   oid, &type, &size);
 
        if (!buf)
                die("unable to read %s", oid_to_hex(oid));
 
-       base_buf = repo_read_object_file(the_repository,
-                                        base, &type,
-                                        &base_size);
+       base_buf = odb_read_object(the_repository->objects,
+                                  base, &type, &base_size);
 
        if (!base_buf)
                die("unable to read %s", oid_to_hex(base));