read_object_file_extended(): drop lookup_replace option
Our sole caller always passes in "1", so we can just drop the parameter entirely. Anybody who doesn't want this behavior could easily call oid_object_info_extended() themselves, as we're just a thin wrapper around it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jan 7, 2023 at 08:50 UTC
7be13f5f743978180ba377e12a312b773ed9af2b
2 files changed
+4
-7
object-file.c
+2
-5
@@ -1698,18 +1698,15 @@ int pretend_object_file(void *buf, unsigned long len, enum object_type type,
1698
void *read_object_file_extended(struct repository *r,
1699
const struct object_id *oid,
1700
enum object_type *type,
1701
- unsigned long *size,
1702
- int lookup_replace)
1701
+ unsigned long *size)
1702
{
1703
struct object_info oi = OBJECT_INFO_INIT;
1705
- unsigned flags = OBJECT_INFO_DIE_IF_CORRUPT;
1704
+ unsigned flags = OBJECT_INFO_DIE_IF_CORRUPT | OBJECT_INFO_LOOKUP_REPLACE;
1705
void *data;
1706
1707
oi.typep = type;
1708
oi.sizep = size;
1709
oi.contentp = &data;
1711
- if (lookup_replace)
1712
- flags |= OBJECT_INFO_LOOKUP_REPLACE;
1710
if (oid_object_info_extended(r, oid, &oi, flags))
1711
return NULL;
1712
object-store.h
+2
-2
@@ -244,13 +244,13 @@ void *map_loose_object(struct repository *r, const struct object_id *oid,
244
void *read_object_file_extended(struct repository *r,
245
const struct object_id *oid,
246
enum object_type *type,
247
- unsigned long *size, int lookup_replace);
247
+ unsigned long *size);
248
static inline void *repo_read_object_file(struct repository *r,
249
const struct object_id *oid,
250
enum object_type *type,
251
unsigned long *size)
252
{
253
- return read_object_file_extended(r, oid, type, size, 1);
253
+ return read_object_file_extended(r, oid, type, size);
254
}
255
#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
256
#define read_object_file(oid, type, size) repo_read_object_file(the_repository, oid, type, size)