diff mbox series

[1/2] builtin/show-ref.c: rename `found_match` to `matches_nr`

Message ID c02ec101ce70a94eb7cc6085249a40d5b30d1474.1654552560.git.me@ttaylorr.com (mailing list archive)
State New, archived
Headers show
Series builtin/show-ref.c: support `--count` for limiting output | expand

Commit Message

Taylor Blau June 6, 2022, 9:56 p.m. UTC
The variable `found_match` has been used since 358ddb62cf (Add "git
show-ref" builtin command, 2006-09-15) to keep track of whether or not
any references were shown by `show-ref` so that the command could exit
with status code "1" when no references were presented to the caller.

`found_match` has always been treated as a boolean, even though it is
incremented every time a reference is shown. Prepare for the subsequent
patch, which will treat this variable as a count, by renaming it
accordingly.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 builtin/show-ref.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 7f8a5332f8..17d5f98fe4 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -14,7 +14,7 @@  static const char * const show_ref_usage[] = {
 	NULL
 };
 
-static int deref_tags, show_head, tags_only, heads_only, found_match, verify,
+static int deref_tags, show_head, tags_only, heads_only, matches_nr, verify,
 	   quiet, hash_only, abbrev, exclude_arg;
 static const char **pattern;
 static const char *exclude_existing_arg;
@@ -78,7 +78,7 @@  static int show_ref(const char *refname, const struct object_id *oid,
 	}
 
 match:
-	found_match++;
+	matches_nr++;
 
 	show_one(refname, oid);
 
@@ -217,7 +217,7 @@  int cmd_show_ref(int argc, const char **argv, const char *prefix)
 	if (show_head)
 		head_ref(show_ref, NULL);
 	for_each_ref(show_ref, NULL);
-	if (!found_match) {
+	if (!matches_nr) {
 		if (verify && !quiet)
 			die("No match");
 		return 1;