Re: [GSoC PATCH v8 5/5] repo: add the --format flag
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Aug 7, 2025, 05:20 UTC
- Message-ID
- <aJQ3tyC0e53iWtVE@pks.im>
- In-Reply-To
- <20250806195537.93302-6-lucasseikioshiro@gmail.com>
On Wed, Aug 06, 2025 at 04:55:37PM -0300, Lucas Seiki Oshiro wrote:
Show 25 quoted lines
> diff --git a/Documentation/git-repo.adoc b/Documentation/git-repo.adoc
> index 1ae9c09fac..2b63954098 100644
> --- a/Documentation/git-repo.adoc
> +++ b/Documentation/git-repo.adoc
> diff --git a/builtin/repo.c b/builtin/repo.c
> index 312fd08c34..37b5726816 100644
> --- a/builtin/repo.c
> +++ b/builtin/repo.c
> @@ -101,8 +108,18 @@ static int print_fields(int argc, const char **argv, struct repository *repo)
> }
>
> get_value(repo, &valbuf);
> - quote_c_style(valbuf.buf, "buf, NULL, 0);
> - printf("%s=%s\n", key, quotbuf.buf);
> +
> + switch (format) {
> + case FORMAT_KEYVALUE:
> + quote_c_style(valbuf.buf, "buf, NULL, 0);
> + printf("%s=%s\n", key, quotbuf.buf);
> + break;
> + case FORMAT_NUL_TERMINATED:
> + printf("%s\n%s%c", key, valbuf.buf, '\0');
> + break;
> + default:
> + BUG("%d: not a valid output format", format);Nit: we typically say it the other way round.
BUG("not a valid output format: %d", format);Doesn't matter too much though as ideally this message shouldn't ever be seen by any user out there.
Other than my two nits the series looks good to me, thanks! I don't terribly mind whether or not those nits are addressed.
Patrick