Skip to content

Commit e1d062e

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c44beea commit e1d062e

File tree

3 files changed

+7
-42
lines changed

3 files changed

+7
-42
lines changed

builtin/pack-objects.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3774,7 +3774,7 @@ static void show_object_pack_hint(struct object *object, const char *name,
37743774
enum stdin_packs_mode mode = *(enum stdin_packs_mode *)data;
37753775
if (mode == STDIN_PACKS_MODE_FOLLOW) {
37763776
if (object->type == OBJ_BLOB &&
3777-
!has_object(the_repository, &object->oid, 0))
3777+
!odb_has_object(the_repository->objects, &object->oid, 0))
37783778
return;
37793779
add_object_entry(&object->oid, object->type, name, 0);
37803780
} else {
@@ -4591,8 +4591,8 @@ static int add_objects_by_path(const char *path,
45914591

45924592
/* Skip objects that do not exist locally. */
45934593
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)
45964596
continue;
45974597

45984598
exclude = is_oid_uninteresting(the_repository, oid);

odb.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -475,37 +475,4 @@ static inline int odb_write_object(struct object_database *odb,
475475
return odb_write_object_ext(odb, buf, len, type, oid, NULL, 0);
476476
}
477477

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-
511478
#endif /* ODB_H */

t/helper/test-pack-deltas.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,14 @@ static void write_ref_delta(struct hashfile *f,
5151
unsigned long size, base_size, delta_size, compressed_size, hdrlen;
5252
enum object_type type;
5353
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);
5756

5857
if (!buf)
5958
die("unable to read %s", oid_to_hex(oid));
6059

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);
6462

6563
if (!base_buf)
6664
die("unable to read %s", oid_to_hex(base));

0 commit comments

Comments
 (0)