reflog expire: use "switch" over enum values
commit20d6b6868c1446d548094a0a8aa4393a9c58447c
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 22 Dec 2021 04:06:43 +0000 (22 05:06 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Dec 2021 00:24:13 +0000 (22 16:24 -0800)
tree0c8ce80b86f59a3814282d81851ca7218132091d
parentf2919bae9836d552a399b67f4f7d26d30128b6d5
reflog expire: use "switch" over enum values

Change code added in 03cb91b18cc (reflog --expire-unreachable: special
case entries in "HEAD" reflog, 2010-04-09) to use a "switch" statement
with an exhaustive list of "case" statements instead of doing numeric
comparisons against the enum labels.

Now we won't assume that "x != UE_ALWAYS" means "(x == UE_HEAD || x ||
UE_NORMAL)". That assumption is true now, but we'd introduce subtle
bugs here if that were to change, now the compiler will notice and
error out on such errors.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/reflog.c