repo: rename struct field to repo_info_field

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Lucas Seiki Oshiro committed Feb 25, 2026 at 13:32 UTC 18f16b889cbc7a9659a253c974f857d2133f7397
1 file changed +14 -13
builtin/repo.c
+14 -13
@@ -31,7 +31,7 @@ enum output_format {
31 FORMAT_NUL_TERMINATED,
32 };
33
34 -struct field {
34 +struct repo_info_field {
35 const char *key;
36 get_value_fn *get_value;
37 };
@@ -63,7 +63,7 @@ static int get_references_format(struct repository *repo, struct strbuf *buf)
63 }
64
65 /* repo_info_field keys must be in lexicographical order */
66 -static const struct field repo_info_field[] = {
66 +static const struct repo_info_field repo_info_field[] = {
67 { "layout.bare", get_layout_bare },
68 { "layout.shallow", get_layout_shallow },
69 { "object.format", get_object_format },
@@ -72,19 +72,20 @@ static const struct field repo_info_field[] = {
72
73 static int repo_info_field_cmp(const void *va, const void *vb)
74 {
75 - const struct field *a = va;
76 - const struct field *b = vb;
75 + const struct repo_info_field *a = va;
76 + const struct repo_info_field *b = vb;
77
78 return strcmp(a->key, b->key);
79 }
80
81 -static const struct field *get_repo_info_field(const char *key)
81 +static const struct repo_info_field *get_repo_info_field(const char *key)
82 {
83 - const struct field search_key = { key, NULL };
84 - const struct field *found = bsearch(&search_key, repo_info_field,
85 - ARRAY_SIZE(repo_info_field),
86 - sizeof(*found),
87 - repo_info_field_cmp);
83 + const struct repo_info_field search_key = { key, NULL };
84 + const struct repo_info_field *found = bsearch(&search_key,
85 + repo_info_field,
86 + ARRAY_SIZE(repo_info_field),
87 + sizeof(*found),
88 + repo_info_field_cmp);
89
90 return found;
91 }
@@ -115,7 +116,7 @@ static int print_fields(int argc, const char **argv,
116
117 for (int i = 0; i < argc; i++) {
118 const char *key = argv[i];
118 - const struct field *field = get_repo_info_field(key);
119 + const struct repo_info_field *field = get_repo_info_field(key);
120
121 if (!field) {
122 ret = error(_("key '%s' not found"), key);
@@ -137,7 +138,7 @@ static int print_all_fields(struct repository *repo,
138 struct strbuf valbuf = STRBUF_INIT;
139
140 for (size_t i = 0; i < ARRAY_SIZE(repo_info_field); i++) {
140 - const struct field *field = &repo_info_field[i];
141 + const struct repo_info_field *field = &repo_info_field[i];
142
143 strbuf_reset(&valbuf);
144 field->get_value(repo, &valbuf);
@@ -164,7 +165,7 @@ static int print_keys(enum output_format format)
165 }
166
167 for (size_t i = 0; i < ARRAY_SIZE(repo_info_field); i++) {
167 - const struct field *field = &repo_info_field[i];
168 + const struct repo_info_field *field = &repo_info_field[i];
169 printf("%s%c", field->key, sep);
170 }
171