public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
To: git@vger.kernel.org
Cc: ps@pks.im, gitster@pobox.com, jltobler@gmail.com,
	avila.jn@gmail.com,
	Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Subject: [PATCH 4/8] repo: rename struct field to repo_info_field
Date: Wed, 18 Feb 2026 18:08:40 -0300	[thread overview]
Message-ID: <20260218211845.96009-5-lucasseikioshiro@gmail.com> (raw)
In-Reply-To: <20260218211845.96009-1-lucasseikioshiro@gmail.com>

Change the name of the struct field to repo_info_field, making it
explicit that it is an internal data type of git-repo-info.

Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
---
 builtin/repo.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/builtin/repo.c b/builtin/repo.c
index c60a41ba7b..f943be7451 100644
--- a/builtin/repo.c
+++ b/builtin/repo.c
@@ -31,7 +31,7 @@ enum output_format {
 	FORMAT_NUL_TERMINATED,
 };
 
-struct field {
+struct repo_info_field {
 	const char *key;
 	get_value_fn *get_value;
 };
@@ -63,7 +63,7 @@ static int get_references_format(struct repository *repo, struct strbuf *buf)
 }
 
 /* repo_info_field keys must be in lexicographical order */
-static const struct field repo_info_field[] = {
+static const struct repo_info_field repo_info_field[] = {
 	{ "layout.bare", get_layout_bare },
 	{ "layout.shallow", get_layout_shallow },
 	{ "object.format", get_object_format },
@@ -72,19 +72,20 @@ static const struct field repo_info_field[] = {
 
 static int repo_info_field_cmp(const void *va, const void *vb)
 {
-	const struct field *a = va;
-	const struct field *b = vb;
+	const struct repo_info_field *a = va;
+	const struct repo_info_field *b = vb;
 
 	return strcmp(a->key, b->key);
 }
 
-static const struct field *get_repo_info_field(const char *key)
+static const struct repo_info_field *get_repo_info_field(const char *key)
 {
-	const struct field search_key = { key, NULL };
-	const struct field *found = bsearch(&search_key, repo_info_field,
-					    ARRAY_SIZE(repo_info_field),
-					    sizeof(*found),
-					    repo_info_field_cmp);
+	const struct repo_info_field search_key = { key, NULL };
+	const struct repo_info_field *found = bsearch(&search_key,
+						      repo_info_field,
+						      ARRAY_SIZE(repo_info_field),
+						      sizeof(*found),
+						      repo_info_field_cmp);
 
 	return found;
 }
@@ -115,7 +116,7 @@ static int print_fields(int argc, const char **argv,
 
 	for (int i = 0; i < argc; i++) {
 		const char *key = argv[i];
-		const struct field *field = get_repo_info_field(key);
+		const struct repo_info_field *field = get_repo_info_field(key);
 
 		if (!field) {
 			ret = error(_("key '%s' not found"), key);
@@ -137,7 +138,7 @@ static int print_all_fields(struct repository *repo,
 	struct strbuf valbuf = STRBUF_INIT;
 
 	for (size_t i = 0; i < ARRAY_SIZE(repo_info_field); i++) {
-		const struct field *field = &repo_info_field[i];
+		const struct repo_info_field *field = &repo_info_field[i];
 
 		strbuf_reset(&valbuf);
 		field->get_value(repo, &valbuf);
@@ -164,7 +165,7 @@ static int print_keys(enum output_format format)
 	}
 
 	for (size_t i = 0; i < ARRAY_SIZE(repo_info_field); i++) {
-		const struct field *field = &repo_info_field[i];
+		const struct repo_info_field *field = &repo_info_field[i];
 		printf("%s%c", field->key, sep);
 	}
 
-- 
2.50.1 (Apple Git-155)


  parent reply	other threads:[~2026-02-18 21:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-18 21:08 [PATCH 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 1/8] CodingGuidelines: instruct to name arrays in singular Lucas Seiki Oshiro
2026-02-19  3:29   ` Eric Sunshine
2026-02-22 21:43     ` Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 2/8] repo: rename repo_info_fields to repo_info_field Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 3/8] repo: replace get_value_fn_for_key by get_repo_info_field Lucas Seiki Oshiro
2026-02-18 21:08 ` Lucas Seiki Oshiro [this message]
2026-02-18 21:08 ` [PATCH 5/8] t1900: rename t1900-repo to t1900-repo-info Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 6/8] t1901: use tr in git repo structure output instead of expected value Lucas Seiki Oshiro
2026-02-20 10:12   ` Patrick Steinhardt
2026-02-22 22:35     ` Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 7/8] Documentation/git-repo: replace 'NUL' with '_NUL_' Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 8/8] Documentation/git-repo: capitalize format descriptions Lucas Seiki Oshiro
2026-02-25 16:32 ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 1/8] CodingGuidelines: instruct to name arrays in singular Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 2/8] repo: rename repo_info_fields to repo_info_field Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 3/8] repo: replace get_value_fn_for_key by get_repo_info_field Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 4/8] repo: rename struct field to repo_info_field Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 5/8] t1900: rename t1900-repo to t1900-repo-info Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 6/8] t1901: adjust nul format output instead of expected value Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 7/8] Documentation/git-repo: replace 'NUL' with '_NUL_' Lucas Seiki Oshiro
2026-02-25 16:32   ` [PATCH v2 8/8] Documentation/git-repo: capitalize format descriptions Lucas Seiki Oshiro
2026-02-25 18:43   ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro
2026-02-25 19:51   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260218211845.96009-5-lucasseikioshiro@gmail.com \
    --to=lucasseikioshiro@gmail.com \
    --cc=avila.jn@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jltobler@gmail.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox