builtin/show-ref: split up different subcommands
commitb14cbae2b528ea8eda7e05febff9c395b8e5c968
authorPatrick Steinhardt <ps@pks.im>
Tue, 31 Oct 2023 08:16:17 +0000 (31 09:16 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 1 Nov 2023 03:09:00 +0000 (1 12:09 +0900)
tree500fa4f338dba605f06a7497ed5c222efefb8586
parentff546ebb59d3a393e43d1ec7c97a08b5972a65ee
builtin/show-ref: split up different subcommands

While not immediately obvious, git-show-ref(1) actually implements three
different subcommands:

    - `git show-ref <patterns>` can be used to list references that
      match a specific pattern.

    - `git show-ref --verify <refs>` can be used to list references.
      These are _not_ patterns.

    - `git show-ref --exclude-existing` can be used as a filter that
      reads references from standard input, performing some conversions
      on each of them.

Let's make this more explicit in the code by splitting up the three
subcommands into separate functions. This also allows us to address the
confusingly named `patterns` variable, which may hold either patterns or
reference names.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/show-ref.c