From: Lucas Seiki Oshiro <lucasseikioshiro@gmail•com>
To: git@vger•kernel.org
Cc: sunshine@sunshineco•com, ps@pks•im, gitster@pobox•com,
jltobler@gmail•com, avila.jn@gmail•com,
Lucas Seiki Oshiro <lucasseikioshiro@gmail•com>
Subject: [PATCH v2 0/8] repo: refactoring leftover nits
Date: Wed, 25 Feb 2026 13:32:09 -0300 [thread overview]
Message-ID: <20260225183559.79303-1-lucasseikioshiro@gmail.com> (raw)
In-Reply-To: <20260218211845.96009-1-lucasseikioshiro@gmail.com>
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)
next prev parent reply other threads:[~2026-02-25 18:36 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 ` [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 ` Lucas Seiki Oshiro [this message]
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=20260225183559.79303-1-lucasseikioshiro@gmail.com \
--to=lucasseikioshiro@gmail$(echo .)com \
--cc=avila.jn@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=jltobler@gmail$(echo .)com \
--cc=ps@pks$(echo .)im \
--cc=sunshine@sunshineco$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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