odb: fix flags parameter to be unsigned
The `flags` parameter accepted by various `for_each_object()` functions is a bitfield of multiple flags. Such parameters are typically unsigned in the Git codebase, but we use `enum odb_for_each_object_flags` in some places. Adapt these function signatures to use the correct type. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Jan 26, 2026 at 10:51 UTC
6358da200fffc7f010f079c3f64ed77f10cd751d
4 files changed
+8
-6
object-file.c
+2
-1
@@ -414,7 +414,8 @@ static int parse_loose_header(const char *hdr, struct object_info *oi)
414
415
int odb_source_loose_read_object_info(struct odb_source *source,
416
const struct object_id *oid,
417
- struct object_info *oi, int flags)
417
+ struct object_info *oi,
418
+ unsigned flags)
419
{
420
int ret;
421
int fd;
object-file.h
+2
-1
@@ -47,7 +47,8 @@ void odb_source_loose_reprepare(struct odb_source *source);
47
48
int odb_source_loose_read_object_info(struct odb_source *source,
49
const struct object_id *oid,
50
- struct object_info *oi, int flags);
50
+ struct object_info *oi,
51
+ unsigned flags);
52
53
int odb_source_loose_read_object_stream(struct odb_read_stream **out,
54
struct odb_source *source,
packfile.c
+2
-2
@@ -2259,7 +2259,7 @@ int has_object_kept_pack(struct repository *r, const struct object_id *oid,
2259
2260
int for_each_object_in_pack(struct packed_git *p,
2261
each_packed_object_fn cb, void *data,
2262
- enum odb_for_each_object_flags flags)
2262
+ unsigned flags)
2263
{
2264
uint32_t i;
2265
int r = 0;
@@ -2302,7 +2302,7 @@ int for_each_object_in_pack(struct packed_git *p,
2302
}
2303
2304
int for_each_packed_object(struct repository *repo, each_packed_object_fn cb,
2305
- void *data, enum odb_for_each_object_flags flags)
2305
+ void *data, unsigned flags)
2306
{
2307
struct odb_source *source;
2308
int r = 0;
packfile.h
+2
-2
@@ -339,9 +339,9 @@ typedef int each_packed_object_fn(const struct object_id *oid,
339
void *data);
340
int for_each_object_in_pack(struct packed_git *p,
341
each_packed_object_fn, void *data,
342
- enum odb_for_each_object_flags flags);
342
+ unsigned flags);
343
int for_each_packed_object(struct repository *repo, each_packed_object_fn cb,
344
- void *data, enum odb_for_each_object_flags flags);
344
+ void *data, unsigned flags);
345
346
/* A hook to report invalid files in pack directory */
347
#define PACKDIR_FILE_PACK 1