* [PATCH 0/8] repo: refactoring leftover nits
@ 2026-02-18 21:08 Lucas Seiki Oshiro
2026-02-18 21:08 ` [PATCH 1/8] CodingGuidelines: instruct to name arrays in singular Lucas Seiki Oshiro
` (8 more replies)
0 siblings, 9 replies; 24+ messages in thread
From: Lucas Seiki Oshiro @ 2026-02-18 21:08 UTC (permalink / raw)
To: git; +Cc: ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro
Hi!
This patchset refactors git-repo-info after some suggestions and after the
introduction of git-repo-structure. These changes were made:
1. CodingGuidelines now contains a instruction for naming arrays in
singular (based on [1])
2. Rename a variable to its singular form in repo.c (based on [1])
3. Replace the function `get_value_fn_for_key` by a new function
`get_repo_info_field` and make the structure of the function `print_fields` closer to the
function `print_all_fields` (based on [1])
4. Rename the struct `field` to `repo_info_field` (after git-repo-structure)
5. Rename t1900-repo to t1900-repo-info (after git-repo-structure)
6. Use `tr` in output instead of the expected value (based on [2])
7. Replace `NUL` by `_NUL_` in the documentation (based on [3])
8. Capitalize some paragraphs in the documentation (based on [4])
This patch is based on top of master 59438b41ab (Merge branch 'master' of
github.com:git/git, 2026-02-18) with lo/repo-info-keys merged.
[1] xmqqh5usiizp.fsf@gitster.g
[2] xmqqh5txfv7b.fsf@gitster.g
[3] 12814829.O9o76ZdvQC@piment-oiseau
[4] aXhiIQXBvMhzkFy9@pks.im
Lucas Seiki Oshiro (8):
CodingGuidelines: instruct to name arrays in singular
repo: rename repo_info_fields to repo_info_field
repo: replace get_value_fn_for_key by get_repo_info_field
repo: rename struct field to repo_info_field
t1900: rename t1900-repo to t1900-repo-info
t1901: use tr in git repo structure output instead of expected value
Documentation/git-repo: replace 'NUL' with '_NUL_'
Documentation/git-repo: capitalize format descriptions
Documentation/CodingGuidelines | 8 +++++
Documentation/git-repo.adoc | 8 ++---
builtin/repo.c | 44 ++++++++++++-------------
t/meson.build | 2 +-
t/{t1900-repo.sh => t1900-repo-info.sh} | 0
t/t1901-repo-structure.sh | 8 ++---
6 files changed, 39 insertions(+), 31 deletions(-)
rename t/{t1900-repo.sh => t1900-repo-info.sh} (100%)
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 24+ messages in thread* [PATCH 1/8] CodingGuidelines: instruct to name arrays in singular 2026-02-18 21:08 [PATCH 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro @ 2026-02-18 21:08 ` Lucas Seiki Oshiro 2026-02-19 3:29 ` Eric Sunshine 2026-02-18 21:08 ` [PATCH 2/8] repo: rename repo_info_fields to repo_info_field Lucas Seiki Oshiro ` (7 subsequent siblings) 8 siblings, 1 reply; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-18 21:08 UTC (permalink / raw) To: git; +Cc: ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro Arrays should be named in the singular form, ensuring that when accessing an element within an array (e.g. dog[0]) it's clear that we're referring to an element instead of a collection. Add a new rule to CodingGuidelines asking for arrays to be named in singular instead of plural. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- Documentation/CodingGuidelines | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index df72fe0177..0158c57277 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -656,6 +656,14 @@ For C programs: unsigned other_field:1; unsigned field_with_longer_name:1; + - Array names should be named in the singular form. E.g.: + + char *dog[] = ...; + + and not: + + char *dogs[] = ...; + For Perl programs: - Most of the C guidelines above apply. -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 1/8] CodingGuidelines: instruct to name arrays in singular 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 0 siblings, 1 reply; 24+ messages in thread From: Eric Sunshine @ 2026-02-19 3:29 UTC (permalink / raw) To: Lucas Seiki Oshiro; +Cc: git, ps, gitster, jltobler, avila.jn On Wed, Feb 18, 2026 at 4:20 PM Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> wrote: > Arrays should be named in the singular form, ensuring that when > accessing an element within an array (e.g. dog[0]) it's clear that > we're referring to an element instead of a collection. > > Add a new rule to CodingGuidelines asking for arrays to be named in > singular instead of plural. > > Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> > --- > diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines > @@ -656,6 +656,14 @@ For C programs: > + - Array names should be named in the singular form. E.g.: > + > + char *dog[] = ...; > + > + and not: > + > + char *dogs[] = ...; > + While this is generally true on this project, it is nevertheless incomplete. More specifically, the singular form is used for an array name in cases when the individual items of the array are the typical subject of use, for instance, when the consumer of the array is walking the dogs one at a time. However, there are cases in which the array is generally employed as a whole, rather than as its unit parts, in which the plural form for the name is preferable. An example would be when walking all the dogs at the same time. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 1/8] CodingGuidelines: instruct to name arrays in singular 2026-02-19 3:29 ` Eric Sunshine @ 2026-02-22 21:43 ` Lucas Seiki Oshiro 0 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-22 21:43 UTC (permalink / raw) To: Eric Sunshine; +Cc: git, ps, gitster, jltobler, avila.jn > While this is generally true on this project, it is nevertheless > incomplete. More specifically, the singular form is used for an array > name in cases when the individual items of the array are the typical > subject of use, for instance, when the consumer of the array is > walking the dogs one at a time. However, there are cases in which the > array is generally employed as a whole, rather than as its unit parts, > in which the plural form for the name is preferable. An example would > be when walking all the dogs at the same time. Thanks, Eric! You explanation was very clear, and I'll use parts of it in the next version, giving credits to you, of course. ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 2/8] repo: rename repo_info_fields to repo_info_field 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-18 21:08 ` 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 ` (6 subsequent siblings) 8 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-18 21:08 UTC (permalink / raw) To: git; +Cc: ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro Rename repo_info_fields as repo_info_field, following the CodingGuidelines rule for naming arrays in singular. Rename all the references to that array accordingly. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- builtin/repo.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/builtin/repo.c b/builtin/repo.c index 6a62a6020a..aa9a154cd2 100644 --- a/builtin/repo.c +++ b/builtin/repo.c @@ -62,15 +62,15 @@ static int get_references_format(struct repository *repo, struct strbuf *buf) return 0; } -/* repo_info_fields keys must be in lexicographical order */ -static const struct field repo_info_fields[] = { +/* repo_info_field keys must be in lexicographical order */ +static const struct field repo_info_field[] = { { "layout.bare", get_layout_bare }, { "layout.shallow", get_layout_shallow }, { "object.format", get_object_format }, { "references.format", get_references_format }, }; -static int repo_info_fields_cmp(const void *va, const void *vb) +static int repo_info_field_cmp(const void *va, const void *vb) { const struct field *a = va; const struct field *b = vb; @@ -81,10 +81,10 @@ static int repo_info_fields_cmp(const void *va, const void *vb) static get_value_fn *get_value_fn_for_key(const char *key) { const struct field search_key = { key, NULL }; - const struct field *found = bsearch(&search_key, repo_info_fields, - ARRAY_SIZE(repo_info_fields), + const struct field *found = bsearch(&search_key, repo_info_field, + ARRAY_SIZE(repo_info_field), sizeof(*found), - repo_info_fields_cmp); + repo_info_field_cmp); return found ? found->get_value : NULL; } @@ -137,8 +137,8 @@ static int print_all_fields(struct repository *repo, { struct strbuf valbuf = STRBUF_INIT; - for (size_t i = 0; i < ARRAY_SIZE(repo_info_fields); i++) { - const struct field *field = &repo_info_fields[i]; + for (size_t i = 0; i < ARRAY_SIZE(repo_info_field); i++) { + const struct field *field = &repo_info_field[i]; strbuf_reset(&valbuf); field->get_value(repo, &valbuf); @@ -164,8 +164,8 @@ static int print_keys(enum output_format format) die(_("--keys can only be used with --format=lines or --format=nul")); } - for (size_t i = 0; i < ARRAY_SIZE(repo_info_fields); i++) { - const struct field *field = &repo_info_fields[i]; + for (size_t i = 0; i < ARRAY_SIZE(repo_info_field); i++) { + const struct field *field = &repo_info_field[i]; printf("%s%c", field->key, sep); } -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 3/8] repo: replace get_value_fn_for_key by get_repo_info_field 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-18 21:08 ` [PATCH 2/8] repo: rename repo_info_fields to repo_info_field Lucas Seiki Oshiro @ 2026-02-18 21:08 ` Lucas Seiki Oshiro 2026-02-18 21:08 ` [PATCH 4/8] repo: rename struct field to repo_info_field Lucas Seiki Oshiro ` (5 subsequent siblings) 8 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-18 21:08 UTC (permalink / raw) To: git; +Cc: ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro Remove the function `get_value_fn_for_key`, which returns a function that retrieves a value for a certain repo info key. Introduce `get_repo_info_field` instead, which returns a struct field. This refactor makes the structure of the function print_fields more consistent to the function print_all_fields, improving its readability. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- builtin/repo.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/builtin/repo.c b/builtin/repo.c index aa9a154cd2..c60a41ba7b 100644 --- a/builtin/repo.c +++ b/builtin/repo.c @@ -78,14 +78,15 @@ static int repo_info_field_cmp(const void *va, const void *vb) return strcmp(a->key, b->key); } -static get_value_fn *get_value_fn_for_key(const char *key) +static const struct 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); - return found ? found->get_value : NULL; + + return found; } static void print_field(enum output_format format, const char *key, @@ -113,18 +114,16 @@ static int print_fields(int argc, const char **argv, struct strbuf valbuf = STRBUF_INIT; for (int i = 0; i < argc; i++) { - get_value_fn *get_value; const char *key = argv[i]; + const struct field *field = get_repo_info_field(key); - get_value = get_value_fn_for_key(key); - - if (!get_value) { + if (!field) { ret = error(_("key '%s' not found"), key); continue; } strbuf_reset(&valbuf); - get_value(repo, &valbuf); + field->get_value(repo, &valbuf); print_field(format, key, valbuf.buf); } -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 4/8] repo: rename struct field to repo_info_field 2026-02-18 21:08 [PATCH 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (2 preceding siblings ...) 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 2026-02-18 21:08 ` [PATCH 5/8] t1900: rename t1900-repo to t1900-repo-info Lucas Seiki Oshiro ` (4 subsequent siblings) 8 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-18 21:08 UTC (permalink / raw) To: git; +Cc: ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro 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) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 5/8] t1900: rename t1900-repo to t1900-repo-info 2026-02-18 21:08 [PATCH 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (3 preceding siblings ...) 2026-02-18 21:08 ` [PATCH 4/8] repo: rename struct field to repo_info_field Lucas Seiki Oshiro @ 2026-02-18 21:08 ` 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 ` (3 subsequent siblings) 8 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-18 21:08 UTC (permalink / raw) To: git; +Cc: ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro Since the commit bbb2b93348 (builtin/repo: introduce structure subcommand, 2025-10-21), t1901 specifically tests git-repo-structure. Rename t1900-repo to t1900-repo-info to clarify that it focus solely on git-repo-info subcommand. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- t/meson.build | 2 +- t/{t1900-repo.sh => t1900-repo-info.sh} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename t/{t1900-repo.sh => t1900-repo-info.sh} (100%) diff --git a/t/meson.build b/t/meson.build index f80e366cff..9867762bac 100644 --- a/t/meson.build +++ b/t/meson.build @@ -240,7 +240,7 @@ integration_tests = [ 't1700-split-index.sh', 't1701-racy-split-index.sh', 't1800-hook.sh', - 't1900-repo.sh', + 't1900-repo-info.sh', 't1901-repo-structure.sh', 't2000-conflict-when-checking-files-out.sh', 't2002-checkout-cache-u.sh', diff --git a/t/t1900-repo.sh b/t/t1900-repo-info.sh similarity index 100% rename from t/t1900-repo.sh rename to t/t1900-repo-info.sh -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 6/8] t1901: use tr in git repo structure output instead of expected value 2026-02-18 21:08 [PATCH 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (4 preceding siblings ...) 2026-02-18 21:08 ` [PATCH 5/8] t1900: rename t1900-repo to t1900-repo-info Lucas Seiki Oshiro @ 2026-02-18 21:08 ` Lucas Seiki Oshiro 2026-02-20 10:12 ` Patrick Steinhardt 2026-02-18 21:08 ` [PATCH 7/8] Documentation/git-repo: replace 'NUL' with '_NUL_' Lucas Seiki Oshiro ` (2 subsequent siblings) 8 siblings, 1 reply; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-18 21:08 UTC (permalink / raw) To: git; +Cc: ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro The test 'keyvalue and nul format', as it description says, test both keyvalue and nul format. These formats are similar, differing only in their field separator (= in the former, LF in the latter) and their record separator (LF in the former, NUL in the latter). This way, both formats can be tested using the same expected output and only replacing the separators in one of the output formats. Adjust the output of `git repo structure --format=nul` in t1901, matching the --format=keyvalue ones. Compare this output against the same value expected from --format=keyvalue. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- t/t1901-repo-structure.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh index a6f2591d9a..4de795181f 100755 --- a/t/t1901-repo-structure.sh +++ b/t/t1901-repo-structure.sh @@ -145,18 +145,18 @@ test_expect_success SHA1 'lines and nul format' ' test_cmp expect out && test_line_count = 0 err && - # Replace key and value delimiters for nul format. - tr "\n=" "\0\n" <expect >expect_nul && git repo structure --format=nul >out 2>err && + tr "\012" "=" <out | tr "\000" "\012" >actual && - test_cmp expect_nul out && + test_cmp expect actual && test_line_count = 0 err && # "-z", as a synonym to "--format=nul", participates in the # usual "last one wins" rule. git repo structure --format=table -z >out 2>err && + tr "\012" "=" <out | tr "\000" "\012" >actual && - test_cmp expect_nul out && + test_cmp expect actual && test_line_count = 0 err ) ' -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 6/8] t1901: use tr in git repo structure output instead of expected value 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 0 siblings, 1 reply; 24+ messages in thread From: Patrick Steinhardt @ 2026-02-20 10:12 UTC (permalink / raw) To: Lucas Seiki Oshiro; +Cc: git, gitster, jltobler, avila.jn On Wed, Feb 18, 2026 at 06:08:42PM -0300, Lucas Seiki Oshiro wrote: > The test 'keyvalue and nul format', as it description says, test both > keyvalue and nul format. These formats are similar, differing only in > their field separator (= in the former, LF in the latter) and their > record separator (LF in the former, NUL in the latter). This way, both > formats can be tested using the same expected output and only replacing > the separators in one of the output formats. Hm, okay. I have to admit I don't quite understand what we gain here. We have to use tr(1) regardless of how we do it, and I cannot see that either of these alternatives is clearly superior compared to the other. > diff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh > index a6f2591d9a..4de795181f 100755 > --- a/t/t1901-repo-structure.sh > +++ b/t/t1901-repo-structure.sh > @@ -145,18 +145,18 @@ test_expect_success SHA1 'lines and nul format' ' > test_cmp expect out && > test_line_count = 0 err && > > - # Replace key and value delimiters for nul format. > - tr "\n=" "\0\n" <expect >expect_nul && > git repo structure --format=nul >out 2>err && > + tr "\012" "=" <out | tr "\000" "\012" >actual && We can combine the two calls to tr(1) to a single one. > - test_cmp expect_nul out && > + test_cmp expect actual && > test_line_count = 0 err && > > # "-z", as a synonym to "--format=nul", participates in the > # usual "last one wins" rule. > git repo structure --format=table -z >out 2>err && > + tr "\012" "=" <out | tr "\000" "\012" >actual && Same here. Patrick ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 6/8] t1901: use tr in git repo structure output instead of expected value 2026-02-20 10:12 ` Patrick Steinhardt @ 2026-02-22 22:35 ` Lucas Seiki Oshiro 0 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-22 22:35 UTC (permalink / raw) To: Patrick Steinhardt; +Cc: git, gitster, jltobler, avila.jn >> The test 'keyvalue and nul format', as it description says, test both >> keyvalue and nul format. These formats are similar, differing only in >> their field separator (= in the former, LF in the latter) and their >> record separator (LF in the former, NUL in the latter). This way, both >> formats can be tested using the same expected output and only replacing >> the separators in one of the output formats. > > Hm, okay. I have to admit I don't quite understand what we gain here. We > have to use tr(1) regardless of how we do it, and I cannot see that > either of these alternatives is clearly superior compared to the other. I should be clearer about this in my description. Of course, both approaches work here but this won't output a NUL character if the test fails, which could be considered as a binary file to diff. Actually, this is something that Junio saw in a previous patch, and this was his comment about it [1]: > * Instead of munging the expected file so that it contains a NUL, > and compare the actual output with it, munge the NUL terminated > outout to make it text and compare with the expected file in text > format. This matters when tests start to fail as test_cmp will > show the "diff" output when it fails, and comparing NUL > terminated files, which are "binary" in the eyes of the "diff" > utility. But anyway, I'll make it clear in my next version. Thanks! [1] xmqqh5txfv7b.fsf@gitster.g ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 7/8] Documentation/git-repo: replace 'NUL' with '_NUL_' 2026-02-18 21:08 [PATCH 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (5 preceding siblings ...) 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-18 21:08 ` 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 8 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-18 21:08 UTC (permalink / raw) To: git; +Cc: ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro Replace all occurrences of "NUL" by "_NUL_" in git-repo.adoc, following the convention used by other documentation files. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- Documentation/git-repo.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-repo.adoc b/Documentation/git-repo.adoc index 319d30bd86..f76f579b20 100644 --- a/Documentation/git-repo.adoc +++ b/Documentation/git-repo.adoc @@ -40,7 +40,7 @@ supported: `nul`::: similar to `lines`, but using a newline character as the delimiter - between the key and the value and using a NUL character after each value. + between the key and the value and using a _NUL_ character after each value. This format is better suited for being parsed by another applications than `lines`. Unlike in the `lines` format, the values are never quoted. + @@ -80,7 +80,7 @@ supported: configuration variable `core.quotePath` (see linkgit:git-config[1]). `nul`::: - Similar to `lines`, but uses a NUL character to delimit between + Similar to `lines`, but uses a _NUL_ character to delimit between key-value pairs instead of a newline. Also uses a newline character as the delimiter between the key and value instead of '='. Unlike the `lines` format, values containing "unusual" characters are never -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 8/8] Documentation/git-repo: capitalize format descriptions 2026-02-18 21:08 [PATCH 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (6 preceding siblings ...) 2026-02-18 21:08 ` [PATCH 7/8] Documentation/git-repo: replace 'NUL' with '_NUL_' Lucas Seiki Oshiro @ 2026-02-18 21:08 ` Lucas Seiki Oshiro 2026-02-25 16:32 ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro 8 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-18 21:08 UTC (permalink / raw) To: git; +Cc: ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro The descriptions for the git-repo output formats are in lowercase. Capitalize these descriptions, making them consistent with the rest of the documentation. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- Documentation/git-repo.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-repo.adoc b/Documentation/git-repo.adoc index f76f579b20..5e2968b707 100644 --- a/Documentation/git-repo.adoc +++ b/Documentation/git-repo.adoc @@ -33,13 +33,13 @@ supported: + `lines`::: - output key-value pairs one per line using the `=` character as + Output key-value pairs one per line using the `=` character as the delimiter between the key and the value. Values containing "unusual" characters are quoted as explained for the configuration variable `core.quotePath` (see linkgit:git-config[1]). This is the default. `nul`::: - similar to `lines`, but using a newline character as the delimiter + Similar to `lines`, but using a newline character as the delimiter between the key and the value and using a _NUL_ character after each value. This format is better suited for being parsed by another applications than `lines`. Unlike in the `lines` format, the values are never quoted. -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 0/8] repo: refactoring leftover nits 2026-02-18 21:08 [PATCH 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (7 preceding siblings ...) 2026-02-18 21:08 ` [PATCH 8/8] Documentation/git-repo: capitalize format descriptions Lucas Seiki Oshiro @ 2026-02-25 16:32 ` Lucas Seiki Oshiro 2026-02-25 16:32 ` [PATCH v2 1/8] CodingGuidelines: instruct to name arrays in singular Lucas Seiki Oshiro ` (9 more replies) 8 siblings, 10 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-25 16:32 UTC (permalink / raw) To: git; +Cc: sunshine, ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro Hi! There are only three changes in this version: 1. Applying Eric's suggestion of instructing to name array plural if we're dealing with the values as a whole 2. Making it clear why we should replace the NUL characters in the files consumed by tes_cmp 3. Replacing characters in just one tr call instead of two Lucas Seiki Oshiro (8): CodingGuidelines: instruct to name arrays in singular repo: rename repo_info_fields to repo_info_field repo: replace get_value_fn_for_key by get_repo_info_field repo: rename struct field to repo_info_field t1900: rename t1900-repo to t1900-repo-info t1901: adjust nul format output instead of expected value Documentation/git-repo: replace 'NUL' with '_NUL_' Documentation/git-repo: capitalize format descriptions Documentation/CodingGuidelines | 13 ++++++++ Documentation/git-repo.adoc | 8 ++--- builtin/repo.c | 44 ++++++++++++------------- t/meson.build | 2 +- t/{t1900-repo.sh => t1900-repo-info.sh} | 0 t/t1901-repo-structure.sh | 8 ++--- 6 files changed, 44 insertions(+), 31 deletions(-) rename t/{t1900-repo.sh => t1900-repo-info.sh} (100%) Range-diff against v1: 1: 041d00fdbf ! 1: 51cfa0901e CodingGuidelines: instruct to name arrays in singular @@ Commit message Add a new rule to CodingGuidelines asking for arrays to be named in singular instead of plural. + Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> ## Documentation/CodingGuidelines ## @@ Documentation/CodingGuidelines: For C programs: unsigned other_field:1; unsigned field_with_longer_name:1; -+ - Array names should be named in the singular form. E.g.: ++ - Array names should be named in the singular form if the individual items are ++ subject of use. E.g.: + + char *dog[] = ...; ++ walk_dog(dog[0]); ++ walk_dog(dog[1]); + -+ and not: ++ Cases where the array is employed as a whole rather than as its unit parts, ++ the plural forms is preferable. E.g: + + char *dogs[] = ...; ++ walk_all_dogs(dogs); + For Perl programs: 2: ccf0e85919 = 2: 35feb400af repo: rename repo_info_fields to repo_info_field 3: eccfcf8164 = 3: f2926725a2 repo: replace get_value_fn_for_key by get_repo_info_field 4: b360e3ea11 = 4: 03874e8021 repo: rename struct field to repo_info_field 5: 3c4ae0550d = 5: 02682a08e7 t1900: rename t1900-repo to t1900-repo-info 6: 63b516b424 ! 6: 10accd800a t1901: use tr in git repo structure output instead of expected value @@ Metadata Author: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> ## Commit message ## - t1901: use tr in git repo structure output instead of expected value + t1901: adjust nul format output instead of expected value The test 'keyvalue and nul format', as it description says, test both - keyvalue and nul format. These formats are similar, differing only in + `keyvalue` and `nul` format. These formats are similar, differing only in their field separator (= in the former, LF in the latter) and their record separator (LF in the former, NUL in the latter). This way, both formats can be tested using the same expected output and only replacing the separators in one of the output formats. + However, it is not desirable to have a NUL character in the files + compared by test_cmp because, if that assetion fails, diff will consider + them binary files and won't display the differences properly. + Adjust the output of `git repo structure --format=nul` in t1901, matching the --format=keyvalue ones. Compare this output against the same value expected - from --format=keyvalue. + from --format=keyvalue, without using files with NUL characters in + test_cmp. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> @@ t/t1901-repo-structure.sh: test_expect_success SHA1 'lines and nul format' ' - # Replace key and value delimiters for nul format. - tr "\n=" "\0\n" <expect >expect_nul && git repo structure --format=nul >out 2>err && -+ tr "\012" "=" <out | tr "\000" "\012" >actual && ++ tr "\012\000" "=\012" <out >actual && - test_cmp expect_nul out && + test_cmp expect actual && @@ t/t1901-repo-structure.sh: test_expect_success SHA1 'lines and nul format' ' # "-z", as a synonym to "--format=nul", participates in the # usual "last one wins" rule. git repo structure --format=table -z >out 2>err && -+ tr "\012" "=" <out | tr "\000" "\012" >actual && ++ tr "\012\000" "=\012" <out >actual && - test_cmp expect_nul out && + test_cmp expect actual && 7: 6e0be4e746 = 7: 508a2af2e3 Documentation/git-repo: replace 'NUL' with '_NUL_' 8: e4125e2370 = 8: cbf17b7abd Documentation/git-repo: capitalize format descriptions -- 2.50.1 (Apple Git-155) ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v2 1/8] CodingGuidelines: instruct to name arrays in singular 2026-02-25 16:32 ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro @ 2026-02-25 16:32 ` Lucas Seiki Oshiro 2026-02-25 16:32 ` [PATCH v2 2/8] repo: rename repo_info_fields to repo_info_field Lucas Seiki Oshiro ` (8 subsequent siblings) 9 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-25 16:32 UTC (permalink / raw) To: git; +Cc: sunshine, ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro Arrays should be named in the singular form, ensuring that when accessing an element within an array (e.g. dog[0]) it's clear that we're referring to an element instead of a collection. Add a new rule to CodingGuidelines asking for arrays to be named in singular instead of plural. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- Documentation/CodingGuidelines | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 51cb70b515..6c595696a5 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -658,6 +658,19 @@ For C programs: unsigned other_field:1; unsigned field_with_longer_name:1; + - Array names should be named in the singular form if the individual items are + subject of use. E.g.: + + char *dog[] = ...; + walk_dog(dog[0]); + walk_dog(dog[1]); + + Cases where the array is employed as a whole rather than as its unit parts, + the plural forms is preferable. E.g: + + char *dogs[] = ...; + walk_all_dogs(dogs); + For Perl programs: - Most of the C guidelines above apply. -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 2/8] repo: rename repo_info_fields to repo_info_field 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 ` 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 ` (7 subsequent siblings) 9 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-25 16:32 UTC (permalink / raw) To: git; +Cc: sunshine, ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro Rename repo_info_fields as repo_info_field, following the CodingGuidelines rule for naming arrays in singular. Rename all the references to that array accordingly. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- builtin/repo.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/builtin/repo.c b/builtin/repo.c index 6a62a6020a..aa9a154cd2 100644 --- a/builtin/repo.c +++ b/builtin/repo.c @@ -62,15 +62,15 @@ static int get_references_format(struct repository *repo, struct strbuf *buf) return 0; } -/* repo_info_fields keys must be in lexicographical order */ -static const struct field repo_info_fields[] = { +/* repo_info_field keys must be in lexicographical order */ +static const struct field repo_info_field[] = { { "layout.bare", get_layout_bare }, { "layout.shallow", get_layout_shallow }, { "object.format", get_object_format }, { "references.format", get_references_format }, }; -static int repo_info_fields_cmp(const void *va, const void *vb) +static int repo_info_field_cmp(const void *va, const void *vb) { const struct field *a = va; const struct field *b = vb; @@ -81,10 +81,10 @@ static int repo_info_fields_cmp(const void *va, const void *vb) static get_value_fn *get_value_fn_for_key(const char *key) { const struct field search_key = { key, NULL }; - const struct field *found = bsearch(&search_key, repo_info_fields, - ARRAY_SIZE(repo_info_fields), + const struct field *found = bsearch(&search_key, repo_info_field, + ARRAY_SIZE(repo_info_field), sizeof(*found), - repo_info_fields_cmp); + repo_info_field_cmp); return found ? found->get_value : NULL; } @@ -137,8 +137,8 @@ static int print_all_fields(struct repository *repo, { struct strbuf valbuf = STRBUF_INIT; - for (size_t i = 0; i < ARRAY_SIZE(repo_info_fields); i++) { - const struct field *field = &repo_info_fields[i]; + for (size_t i = 0; i < ARRAY_SIZE(repo_info_field); i++) { + const struct field *field = &repo_info_field[i]; strbuf_reset(&valbuf); field->get_value(repo, &valbuf); @@ -164,8 +164,8 @@ static int print_keys(enum output_format format) die(_("--keys can only be used with --format=lines or --format=nul")); } - for (size_t i = 0; i < ARRAY_SIZE(repo_info_fields); i++) { - const struct field *field = &repo_info_fields[i]; + for (size_t i = 0; i < ARRAY_SIZE(repo_info_field); i++) { + const struct field *field = &repo_info_field[i]; printf("%s%c", field->key, sep); } -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 3/8] repo: replace get_value_fn_for_key by get_repo_info_field 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 ` Lucas Seiki Oshiro 2026-02-25 16:32 ` [PATCH v2 4/8] repo: rename struct field to repo_info_field Lucas Seiki Oshiro ` (6 subsequent siblings) 9 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-25 16:32 UTC (permalink / raw) To: git; +Cc: sunshine, ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro Remove the function `get_value_fn_for_key`, which returns a function that retrieves a value for a certain repo info key. Introduce `get_repo_info_field` instead, which returns a struct field. This refactor makes the structure of the function print_fields more consistent to the function print_all_fields, improving its readability. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- builtin/repo.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/builtin/repo.c b/builtin/repo.c index aa9a154cd2..c60a41ba7b 100644 --- a/builtin/repo.c +++ b/builtin/repo.c @@ -78,14 +78,15 @@ static int repo_info_field_cmp(const void *va, const void *vb) return strcmp(a->key, b->key); } -static get_value_fn *get_value_fn_for_key(const char *key) +static const struct 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); - return found ? found->get_value : NULL; + + return found; } static void print_field(enum output_format format, const char *key, @@ -113,18 +114,16 @@ static int print_fields(int argc, const char **argv, struct strbuf valbuf = STRBUF_INIT; for (int i = 0; i < argc; i++) { - get_value_fn *get_value; const char *key = argv[i]; + const struct field *field = get_repo_info_field(key); - get_value = get_value_fn_for_key(key); - - if (!get_value) { + if (!field) { ret = error(_("key '%s' not found"), key); continue; } strbuf_reset(&valbuf); - get_value(repo, &valbuf); + field->get_value(repo, &valbuf); print_field(format, key, valbuf.buf); } -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 4/8] repo: rename struct field to repo_info_field 2026-02-25 16:32 ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (2 preceding siblings ...) 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 ` Lucas Seiki Oshiro 2026-02-25 16:32 ` [PATCH v2 5/8] t1900: rename t1900-repo to t1900-repo-info Lucas Seiki Oshiro ` (5 subsequent siblings) 9 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-25 16:32 UTC (permalink / raw) To: git; +Cc: sunshine, ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro 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) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 5/8] t1900: rename t1900-repo to t1900-repo-info 2026-02-25 16:32 ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (3 preceding siblings ...) 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 ` Lucas Seiki Oshiro 2026-02-25 16:32 ` [PATCH v2 6/8] t1901: adjust nul format output instead of expected value Lucas Seiki Oshiro ` (4 subsequent siblings) 9 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-25 16:32 UTC (permalink / raw) To: git; +Cc: sunshine, ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro Since the commit bbb2b93348 (builtin/repo: introduce structure subcommand, 2025-10-21), t1901 specifically tests git-repo-structure. Rename t1900-repo to t1900-repo-info to clarify that it focus solely on git-repo-info subcommand. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- t/meson.build | 2 +- t/{t1900-repo.sh => t1900-repo-info.sh} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename t/{t1900-repo.sh => t1900-repo-info.sh} (100%) diff --git a/t/meson.build b/t/meson.build index f80e366cff..9867762bac 100644 --- a/t/meson.build +++ b/t/meson.build @@ -240,7 +240,7 @@ integration_tests = [ 't1700-split-index.sh', 't1701-racy-split-index.sh', 't1800-hook.sh', - 't1900-repo.sh', + 't1900-repo-info.sh', 't1901-repo-structure.sh', 't2000-conflict-when-checking-files-out.sh', 't2002-checkout-cache-u.sh', diff --git a/t/t1900-repo.sh b/t/t1900-repo-info.sh similarity index 100% rename from t/t1900-repo.sh rename to t/t1900-repo-info.sh -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 6/8] t1901: adjust nul format output instead of expected value 2026-02-25 16:32 ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (4 preceding siblings ...) 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 ` Lucas Seiki Oshiro 2026-02-25 16:32 ` [PATCH v2 7/8] Documentation/git-repo: replace 'NUL' with '_NUL_' Lucas Seiki Oshiro ` (3 subsequent siblings) 9 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-25 16:32 UTC (permalink / raw) To: git; +Cc: sunshine, ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro The test 'keyvalue and nul format', as it description says, test both `keyvalue` and `nul` format. These formats are similar, differing only in their field separator (= in the former, LF in the latter) and their record separator (LF in the former, NUL in the latter). This way, both formats can be tested using the same expected output and only replacing the separators in one of the output formats. However, it is not desirable to have a NUL character in the files compared by test_cmp because, if that assetion fails, diff will consider them binary files and won't display the differences properly. Adjust the output of `git repo structure --format=nul` in t1901, matching the --format=keyvalue ones. Compare this output against the same value expected from --format=keyvalue, without using files with NUL characters in test_cmp. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- t/t1901-repo-structure.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh index a6f2591d9a..a67b38ab17 100755 --- a/t/t1901-repo-structure.sh +++ b/t/t1901-repo-structure.sh @@ -145,18 +145,18 @@ test_expect_success SHA1 'lines and nul format' ' test_cmp expect out && test_line_count = 0 err && - # Replace key and value delimiters for nul format. - tr "\n=" "\0\n" <expect >expect_nul && git repo structure --format=nul >out 2>err && + tr "\012\000" "=\012" <out >actual && - test_cmp expect_nul out && + test_cmp expect actual && test_line_count = 0 err && # "-z", as a synonym to "--format=nul", participates in the # usual "last one wins" rule. git repo structure --format=table -z >out 2>err && + tr "\012\000" "=\012" <out >actual && - test_cmp expect_nul out && + test_cmp expect actual && test_line_count = 0 err ) ' -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 7/8] Documentation/git-repo: replace 'NUL' with '_NUL_' 2026-02-25 16:32 ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (5 preceding siblings ...) 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 ` Lucas Seiki Oshiro 2026-02-25 16:32 ` [PATCH v2 8/8] Documentation/git-repo: capitalize format descriptions Lucas Seiki Oshiro ` (2 subsequent siblings) 9 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-25 16:32 UTC (permalink / raw) To: git; +Cc: sunshine, ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro Replace all occurrences of "NUL" by "_NUL_" in git-repo.adoc, following the convention used by other documentation files. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- Documentation/git-repo.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-repo.adoc b/Documentation/git-repo.adoc index 319d30bd86..f76f579b20 100644 --- a/Documentation/git-repo.adoc +++ b/Documentation/git-repo.adoc @@ -40,7 +40,7 @@ supported: `nul`::: similar to `lines`, but using a newline character as the delimiter - between the key and the value and using a NUL character after each value. + between the key and the value and using a _NUL_ character after each value. This format is better suited for being parsed by another applications than `lines`. Unlike in the `lines` format, the values are never quoted. + @@ -80,7 +80,7 @@ supported: configuration variable `core.quotePath` (see linkgit:git-config[1]). `nul`::: - Similar to `lines`, but uses a NUL character to delimit between + Similar to `lines`, but uses a _NUL_ character to delimit between key-value pairs instead of a newline. Also uses a newline character as the delimiter between the key and value instead of '='. Unlike the `lines` format, values containing "unusual" characters are never -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH v2 8/8] Documentation/git-repo: capitalize format descriptions 2026-02-25 16:32 ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (6 preceding siblings ...) 2026-02-25 16:32 ` [PATCH v2 7/8] Documentation/git-repo: replace 'NUL' with '_NUL_' Lucas Seiki Oshiro @ 2026-02-25 16:32 ` 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 9 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-25 16:32 UTC (permalink / raw) To: git; +Cc: sunshine, ps, gitster, jltobler, avila.jn, Lucas Seiki Oshiro The descriptions for the git-repo output formats are in lowercase. Capitalize these descriptions, making them consistent with the rest of the documentation. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> --- Documentation/git-repo.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-repo.adoc b/Documentation/git-repo.adoc index f76f579b20..5e2968b707 100644 --- a/Documentation/git-repo.adoc +++ b/Documentation/git-repo.adoc @@ -33,13 +33,13 @@ supported: + `lines`::: - output key-value pairs one per line using the `=` character as + Output key-value pairs one per line using the `=` character as the delimiter between the key and the value. Values containing "unusual" characters are quoted as explained for the configuration variable `core.quotePath` (see linkgit:git-config[1]). This is the default. `nul`::: - similar to `lines`, but using a newline character as the delimiter + Similar to `lines`, but using a newline character as the delimiter between the key and the value and using a _NUL_ character after each value. This format is better suited for being parsed by another applications than `lines`. Unlike in the `lines` format, the values are never quoted. -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v2 0/8] repo: refactoring leftover nits 2026-02-25 16:32 ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (7 preceding siblings ...) 2026-02-25 16:32 ` [PATCH v2 8/8] Documentation/git-repo: capitalize format descriptions Lucas Seiki Oshiro @ 2026-02-25 18:43 ` Lucas Seiki Oshiro 2026-02-25 19:51 ` Junio C Hamano 9 siblings, 0 replies; 24+ messages in thread From: Lucas Seiki Oshiro @ 2026-02-25 18:43 UTC (permalink / raw) To: git; +Cc: sunshine, ps, gitster, jltobler, avila.jn I forgot to say in the cover letter, but this was built on top of the current master (7c02d39fc2 (The 6th batch, 2026-02-20)) with lo/repo-info-keys merge, which is already marked as "Will merge to 'master'". ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v2 0/8] repo: refactoring leftover nits 2026-02-25 16:32 ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro ` (8 preceding siblings ...) 2026-02-25 18:43 ` [PATCH v2 0/8] repo: refactoring leftover nits Lucas Seiki Oshiro @ 2026-02-25 19:51 ` Junio C Hamano 9 siblings, 0 replies; 24+ messages in thread From: Junio C Hamano @ 2026-02-25 19:51 UTC (permalink / raw) To: Lucas Seiki Oshiro; +Cc: git, sunshine, ps, jltobler, avila.jn Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> writes: > Hi! > > There are only three changes in this version: > > 1. Applying Eric's suggestion of instructing to name array plural if we're > dealing with the values as a whole > 2. Making it clear why we should replace the NUL characters in the files > consumed by tes_cmp > 3. Replacing characters in just one tr call instead of two All look great. The first patch has still rooms to bikeshed, but let's take this iteration and mark it for 'next'. Thanks. ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2026-02-25 19:51 UTC | newest] Thread overview: 24+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` [PATCH 4/8] repo: rename struct field to repo_info_field Lucas Seiki Oshiro 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox