Subject: Re: [PATCH 1/3] reflog: libify delete reflog function and helpers

From: Junio C Hamano <[email-masked]>
Date: Sat, 19 Feb 2022 23:49:16 -0800

Ævar Arnfjörð Bjarmason <[email-masked]> writes:

>> Perhaps prefix them with REFLOG_ or something?
>>
>> Or, do we even NEED to expose these bits outside the implementation
>> of reflog.c?  If these three constants are used ONLY by reflog.c and
>> not by builtin/reflog.c (or builtin/stash.c), then moving them to
>> where they are used, i.e. in reflog.c, without exposing them to
>> others in reflog.h, would be a far better thing to do.  That way,
>> they can stay with their original name, without having to add a
>> differentiating prefix.
>
> No objection to this, but FWIW the general pattern for these object.h
> flags is to use these un-prefixed names:
>
>      git grep -A20 'Remember to update object flag allocation' | grep define
>
> To be fair the only one that's really comparable is the revision.h ones,
> but those are very non-namespace-y, with names like SEEN, ADDED, SHOWN
> etc.

Yes, but I consider that revision.h owns the flag bits, and all
others that are local to a single *.c files borrow leftover bits
(and that is why the allocations can be overlapping).

And that is why my preference is to keep these within reflog.c if we
are separating it out of builtin/reflog.c to make sure they do not
pollute global namespace.