Re: [PATCH 03/13] refs: refactor reference status flags
Patrick Steinhardt <ps@pks.im> writes:
Show 9 quoted lines
> The reference flags encode information like whether or not a reference
> is a symbolic reference or whether it may be broken. This information is
> stored in a `int flags` bitfield, which is in conflict with our modern
> best practices; we tend to use an unsigned integer to store flags.
>
> Change the type of the field to be `unsigned`. While at it, refactor the
> individual flags to be part of an `enum` instead of using preprocessor
> defines.
>
Using an enum is much nicer.
Show 17 quoted lines
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> refs.h | 41 +++++++++++++++++++++--------------------
> 1 file changed, 21 insertions(+), 20 deletions(-)
>
> diff --git a/refs.h b/refs.h
> index 2b24a3d997..8f484e2ffc 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -333,27 +333,28 @@ struct ref_transaction;
> * stored in ref_iterator::flags. Other bits are for internal use
> * only:
> */
> +enum reference_status {
> + /* Reference is a symbolic reference. */
> + REF_ISSYMREF = (1 << 0),
>Nit: It would also be nice to rename these flags to
'REFERENCE_STATUS_*', since that seems to be the pattern we generally
follow. Doesn't have to be in your series though :)
Rest looks good.