]> git.ipfire.org Git - thirdparty/git.git/commit
parse-options: change OPT_{SHORT,UNSET} to an enum
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 8 Oct 2021 19:07:46 +0000 (21:07 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Oct 2021 21:13:11 +0000 (14:13 -0700)
commitd342834529495508fa1f23e223d4917cbdcfb54d
tree429c000af6a89c165613af5eb94b9ff3815da897
parent62f2ffc56307c794a15e572b9504ff6adff2d2d8
parse-options: change OPT_{SHORT,UNSET} to an enum

Change the comparisons against OPT_SHORT and OPT_UNSET to an enum
which keeps track of how a given option got parsed. The case of "0"
was an implicit OPT_LONG, so let's add an explicit label for it.

Due to the xor in 0f1930c5875 (parse-options: allow positivation of
options starting, with no-, 2012-02-25) the code already relied on
this being set back to 0. To avoid refactoring the logic involved in
that let's just start the enum at "0" instead of the usual "1<<0" (1),
but BUG() out if we don't have one of our expected flags.

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