From 339e9621794c809c08dea9ba46cbf0eef6db6594 Mon Sep 17 00:00:00 2001 From: Lucas Seiki Oshiro Date: Wed, 18 Feb 2026 18:08:40 -0300 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- 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); }