Re: [GSoC PATCH v8 5/5] repo: add the --format flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 06, 2025 at 04:55:37PM -0300, Lucas Seiki Oshiro wrote:
> 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, &quotbuf, NULL, 0);
> -		printf("%s=%s\n", key, quotbuf.buf);
> +
> +		switch (format) {
> +		case FORMAT_KEYVALUE:
> +			quote_c_style(valbuf.buf, &quotbuf, 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux