object-file: rename `has_loose_object()`

Rename `has_loose_object()` to `odb_source_loose_has_object()` so that it becomes clear that this is tied to a specific loose object source. This matches our modern naming schema for functions. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Nov 3, 2025 at 08:42 UTC 05130c6c9eed9ff7450e9067d7215032eb914c10
3 files changed +13 -13
builtin/pack-objects.c
+2 -2
@@ -1716,7 +1716,7 @@ static int want_object_in_pack_mtime(const struct object_id *oid,
1716 */
1717 struct odb_source *source = the_repository->objects->sources->next;
1718 for (; source; source = source->next)
1719 - if (has_loose_object(source, oid))
1719 + if (odb_source_loose_has_object(source, oid))
1720 return 0;
1721 }
1722
@@ -3978,7 +3978,7 @@ static void add_cruft_object_entry(const struct object_id *oid, enum object_type
3978 int found = 0;
3979
3980 for (; !found && source; source = source->next)
3981 - if (has_loose_object(source, oid))
3981 + if (odb_source_loose_has_object(source, oid))
3982 found = 1;
3983
3984 /*
object-file.c
+3 -3
@@ -99,8 +99,8 @@ static int check_and_freshen_source(struct odb_source *source,
99 return check_and_freshen_file(path.buf, freshen);
100 }
101
102 -int has_loose_object(struct odb_source *source,
103 - const struct object_id *oid)
102 +int odb_source_loose_has_object(struct odb_source *source,
103 + const struct object_id *oid)
104 {
105 return check_and_freshen_source(source, oid, 0);
106 }
@@ -1161,7 +1161,7 @@ int force_object_loose(struct odb_source *source,
1161 int ret;
1162
1163 for (struct odb_source *s = source->odb->sources; s; s = s->next)
1164 - if (has_loose_object(s, oid))
1164 + if (odb_source_loose_has_object(s, oid))
1165 return 0;
1166
1167 oi.typep = &type;
object-file.h
+8 -8
@@ -51,6 +51,14 @@ void *odb_source_loose_map_object(struct odb_source *source,
51 const struct object_id *oid,
52 unsigned long *size);
53
54 +/*
55 + * Return true iff an object database source has a loose object
56 + * with the specified name. This function does not respect replace
57 + * references.
58 + */
59 +int odb_source_loose_has_object(struct odb_source *source,
60 + const struct object_id *oid);
61 +
62 /*
63 * Populate and return the loose object cache array corresponding to the
64 * given object ID.
@@ -66,14 +74,6 @@ const char *odb_loose_path(struct odb_source *source,
74 struct strbuf *buf,
75 const struct object_id *oid);
76
69 -/*
70 - * Return true iff an object database source has a loose object
71 - * with the specified name. This function does not respect replace
72 - * references.
73 - */
74 -int has_loose_object(struct odb_source *source,
75 - const struct object_id *oid);
76 -
77 /*
78 * Iterate over the files in the loose-object parts of the object
79 * directory "path", triggering the following callbacks: