reflog: convert to parse_options() API
commite3c3675801f6d7494ac11e772e848981d1e158b4
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 17 Mar 2022 18:08:39 +0000 (17 19:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Mar 2022 22:26:39 +0000 (23 15:26 -0700)
treebdf4a0281defe3227482c5df48352144f8ee3ea1
parenta34393f5f8152ad8bdbf15bccffc2be12a9a19ca
reflog: convert to parse_options() API

Continue the work started in 33d7bdd6459 (builtin/reflog.c: use
parse-options api for expire, delete subcommands, 2022-01-06) and
convert the cmd_reflog() function itself to use the parse_options()
API.

Let's also add a test which would fail if we forgot
PARSE_OPT_NO_INTERNAL_HELP here, as well as making sure that we'll
still pass through "--" by supplying PARSE_OPT_KEEP_DASHDASH. For that
test we need to change "test_commit()" to accept files starting with
"--".

The "git reflog -h" usage will now show the usage for all of the
sub-commands, rather than a terse summary which wasn't
correct (e.g. "git reflog exists" is not a valid command). See my
8757b35d443 (commit-graph: define common usage with a macro,
2021-08-23) for prior art.

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