Re: [PATCH 09/11] read-cache: require flags for `write_locked_index()`
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 2, 2017, 03:49 UTC
- Message-ID
- <xmqqd166qkeg.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <d912e33a1395ff25c1496715d0a537858daa885a.1506862824.git.martin.agren@gmail.com>
Martin Ågren <martin.agren@gmail.com> writes:
Show 5 quoted lines
> ... Instead, require that one of the > flags is set. Adjust documentation and the assert we already have for > checking that we don't have too many flags. Add a macro `HAS_SINGLE_BIT` > (inspired by `HAS_MULTI_BITS`) to simplify this check and similar checks > in the future.
I do not have a strong opinion against this approach, but if something can take only one of two values, wouldn't it make more sense to express it as a single boolean, I wonder. Then there is no need to invent a cute HAS_SINGLE_BIT() macro, either.
"commit and leave it open" cannot be expressed with such a scheme, but with the HAS_SINGLE_BIT() scheme it can't anyway, so...