Skip to content

Commit 732ec9b

Browse files
pks-tgitster
authored andcommitted
odb: convert odb_has_object() flags into an enum
Following the reason in the preceding commit, convert the `odb_has_object()` flags into an enum. With this change, we would have catched the misuse of `odb_has_object()` that was fixed in a preceding commit as the compiler would have generated a warning: ../builtin/backfill.c:71:9: error: implicit conversion from enumeration type 'enum odb_object_info_flag' to different enumeration type 'enum odb_has_object_flag' [-Werror,-Wenum-conversion] 70 | if (!odb_has_object(ctx->repo->objects, &list->oid[i], | ~~~~~~~~~~~~~~ 71 | OBJECT_INFO_FOR_PREFETCH)) | ^~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent f6516a5 commit 732ec9b

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

odb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ void *odb_read_object_peeled(struct object_database *odb,
964964
}
965965

966966
int odb_has_object(struct object_database *odb, const struct object_id *oid,
967-
unsigned flags)
967+
enum has_object_flags flags)
968968
{
969969
unsigned object_info_flags = 0;
970970

odb.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ int odb_read_object_info(struct object_database *odb,
395395
const struct object_id *oid,
396396
unsigned long *sizep);
397397

398-
enum {
398+
enum has_object_flags {
399399
/* Retry packed storage after checking packed and loose storage */
400400
HAS_OBJECT_RECHECK_PACKED = (1 << 0),
401401
/* Allow fetching the object in case the repository has a promisor remote. */
@@ -408,7 +408,7 @@ enum {
408408
*/
409409
int odb_has_object(struct object_database *odb,
410410
const struct object_id *oid,
411-
unsigned flags);
411+
enum has_object_flags flags);
412412

413413
int odb_freshen_object(struct object_database *odb,
414414
const struct object_id *oid);

0 commit comments

Comments
 (0)