git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/8] repo: rename struct field to repo_info_field

From
Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Date
Feb 18, 2026, 21:08 UTC
Message-ID
<20260218211845.96009-5-lucasseikioshiro@gmail.com>
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)
Previous: Lucas Seiki OshiroNext: Lucas Seiki Oshiro
Message 7 of 24 in “repo: refactoring leftover nits”
  1. 0/8 repo: refactoring leftover nitsLucas Seiki Oshiro, Feb 18, 2026
  2. 1/8 CodingGuidelines: instruct to name arrays in singularLucas Seiki Oshiro, Feb 18, 2026
  3. Eric SunshineFeb 19, 2026
  4. Lucas Seiki OshiroFeb 22, 2026
  5. 2/8 repo: rename repo_info_fields to repo_info_fieldLucas Seiki Oshiro, Feb 18, 2026
  6. 3/8 repo: replace get_value_fn_for_key by get_repo_info_fieldLucas Seiki Oshiro, Feb 18, 2026
  7. 4/8 repo: rename struct field to repo_info_fieldLucas Seiki Oshiro, Feb 18, 2026
  8. 5/8 t1900: rename t1900-repo to t1900-repo-infoLucas Seiki Oshiro, Feb 18, 2026
  9. 6/8 t1901: use tr in git repo structure output instead of expected valueLucas Seiki Oshiro, Feb 18, 2026
  10. Patrick SteinhardtFeb 20, 2026
  11. Lucas Seiki OshiroFeb 22, 2026
  12. 7/8 Documentation/git-repo: replace 'NUL' with '_NUL_'Lucas Seiki Oshiro, Feb 18, 2026
  13. 8/8 Documentation/git-repo: capitalize format descriptionsLucas Seiki Oshiro, Feb 18, 2026
  14. 0/8 repo: refactoring leftover nitsLucas Seiki Oshiro, Feb 25, 2026
  15. 1/8 CodingGuidelines: instruct to name arrays in singularLucas Seiki Oshiro, Feb 25, 2026
  16. 2/8 repo: rename repo_info_fields to repo_info_fieldLucas Seiki Oshiro, Feb 25, 2026
  17. 3/8 repo: replace get_value_fn_for_key by get_repo_info_fieldLucas Seiki Oshiro, Feb 25, 2026
  18. 4/8 repo: rename struct field to repo_info_fieldLucas Seiki Oshiro, Feb 25, 2026
  19. 5/8 t1900: rename t1900-repo to t1900-repo-infoLucas Seiki Oshiro, Feb 25, 2026
  20. 6/8 t1901: adjust nul format output instead of expected valueLucas Seiki Oshiro, Feb 25, 2026
  21. 7/8 Documentation/git-repo: replace 'NUL' with '_NUL_'Lucas Seiki Oshiro, Feb 25, 2026
  22. 8/8 Documentation/git-repo: capitalize format descriptionsLucas Seiki Oshiro, Feb 25, 2026
  23. Lucas Seiki OshiroFeb 25, 2026
  24. Junio C HamanoFeb 25, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.