Skip to content

builtin/show-ref.c: support `--count` for limiting output

Taylor Blau git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2builtin/show-ref.c: rename `found_match` to `matches_nr`builtin/show-ref.c+3 -30 replies
2/2builtin/show-ref.c: limit output with `--count`Documentation/git-show-ref.txt builtin/show-ref.c t/t1403-show-ref.sh+49 -25 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] builtin/show-ref.c: support `--count` for limiting output

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@ttaylorr.com/

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(-)
Signature · 1 line
2.36.1.94.gb0d54bedca