refs: convert ref storage format to an enum

The ref storage format is tracked as a simple unsigned integer, which
makes it harder than necessary to discover what that integer actually is
or where its values are defined.

Convert the ref storage format to instead be an enum.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2024-06-06 07:29:01 +02:00
committed by Junio C Hamano
parent a83f7f51e1
commit 318efb966b
8 changed files with 29 additions and 22 deletions

10
refs.h
View File

@ -11,8 +11,14 @@ struct string_list;
struct string_list_item;
struct worktree;
unsigned int ref_storage_format_by_name(const char *name);
const char *ref_storage_format_to_name(unsigned int ref_storage_format);
enum ref_storage_format {
REF_STORAGE_FORMAT_UNKNOWN,
REF_STORAGE_FORMAT_FILES,
REF_STORAGE_FORMAT_REFTABLE,
};
enum ref_storage_format ref_storage_format_by_name(const char *name);
const char *ref_storage_format_to_name(enum ref_storage_format ref_storage_format);
/*
* Resolve a reference, recursively following symbolic refererences.