This short patch series adds support for a new `--count` argument for limiting the output of `show-ref` (à-la the `for-each-ref` option by the same name). This is useful in contexts where a caller wants to avoid enumerating more references than necessary (e.g., they only care whether a tag exists, but not how many or what they are called) but doesn't have control of the output stream (e.g., they are in Ruby and can't pipe the output to `head -n 1`). The first patch is preparatory, and the second patch implements the new option. This series doesn't conflict with my recent [1], and can be applied independently. Thanks in advance for your review! [1]: https://lore.kernel.org/git/3fa6932641f18d78156bbf60b1571383f2cb5046.1654293264.git.me@xxxxxxxxxxxx/ Taylor Blau (2): builtin/show-ref.c: rename `found_match` to `matches_nr` builtin/show-ref.c: limit output with `--count` Documentation/git-show-ref.txt | 7 ++++++- builtin/show-ref.c | 29 +++++++++++++++++++++++++---- t/t1403-show-ref.sh | 21 +++++++++++++++++++++ 3 files changed, 52 insertions(+), 5 deletions(-) -- 2.36.1.94.gb0d54bedca