odb: drop deprecated wrapper functions

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>

Patrick Steinhardt committed Sep 10, 2025 at 15:12 UTC e1d062e8ba0b72f49e9ef9713cc7011c330baab8
3 files changed +7 -42
builtin/pack-objects.c
+3 -3
@@ -3774,7 +3774,7 @@ static void show_object_pack_hint(struct object *object, const char *name,
3774 enum stdin_packs_mode mode = *(enum stdin_packs_mode *)data;
3775 if (mode == STDIN_PACKS_MODE_FOLLOW) {
3776 if (object->type == OBJ_BLOB &&
3777 - !has_object(the_repository, &object->oid, 0))
3777 + !odb_has_object(the_repository->objects, &object->oid, 0))
3778 return;
3779 add_object_entry(&object->oid, object->type, name, 0);
3780 } else {
@@ -4591,8 +4591,8 @@ static int add_objects_by_path(const char *path,
4591
4592 /* Skip objects that do not exist locally. */
4593 if ((exclude_promisor_objects || arg_missing_action != MA_ERROR) &&
4594 - oid_object_info_extended(the_repository, oid, &oi,
4595 - OBJECT_INFO_FOR_PREFETCH) < 0)
4594 + odb_read_object_info_extended(the_repository->objects, oid, &oi,
4595 + OBJECT_INFO_FOR_PREFETCH) < 0)
4596 continue;
4597
4598 exclude = is_oid_uninteresting(the_repository, oid);
odb.h
-33
@@ -475,37 +475,4 @@ static inline int odb_write_object(struct object_database *odb,
475 return odb_write_object_ext(odb, buf, len, type, oid, NULL, 0);
476 }
477
478 -/* Compatibility wrappers, to be removed once Git 2.51 has been released. */
479 -#include "repository.h"
480 -
481 -static inline int oid_object_info_extended(struct repository *r,
482 - const struct object_id *oid,
483 - struct object_info *oi,
484 - unsigned flags)
485 -{
486 - return odb_read_object_info_extended(r->objects, oid, oi, flags);
487 -}
488 -
489 -static inline int oid_object_info(struct repository *r,
490 - const struct object_id *oid,
491 - unsigned long *sizep)
492 -{
493 - return odb_read_object_info(r->objects, oid, sizep);
494 -}
495 -
496 -static inline void *repo_read_object_file(struct repository *r,
497 - const struct object_id *oid,
498 - enum object_type *type,
499 - unsigned long *size)
500 -{
501 - return odb_read_object(r->objects, oid, type, size);
502 -}
503 -
504 -static inline int has_object(struct repository *r,
505 - const struct object_id *oid,
506 - unsigned flags)
507 -{
508 - return odb_has_object(r->objects, oid, flags);
509 -}
510 -
478 #endif /* ODB_H */
t/helper/test-pack-deltas.c
+4 -6
@@ -51,16 +51,14 @@ static void write_ref_delta(struct hashfile *f,
51 unsigned long size, base_size, delta_size, compressed_size, hdrlen;
52 enum object_type type;
53 void *base_buf, *delta_buf;
54 - void *buf = repo_read_object_file(the_repository,
55 - oid, &type,
56 - &size);
54 + void *buf = odb_read_object(the_repository->objects,
55 + oid, &type, &size);
56
57 if (!buf)
58 die("unable to read %s", oid_to_hex(oid));
59
61 - base_buf = repo_read_object_file(the_repository,
62 - base, &type,
63 - &base_size);
60 + base_buf = odb_read_object(the_repository->objects,
61 + base, &type, &base_size);
62
63 if (!base_buf)
64 die("unable to read %s", oid_to_hex(base));