Re: [GSoC RFC PATCH v4 2/4] repo: add the field references.format
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jul 17, 2025, 13:03 UTC
- Message-ID
- <aHj0lF5Kbirzv3pZ@pks.im>
- In-Reply-To
- <2v7b6mpufnn6cj7u7tactgu2ibggn4xpuezl2bsfjxv62afrsa@chfrii6vkrx3>
On Wed, Jul 16, 2025 at 09:04:40AM -0500, Justin Tobler wrote:
Show 25 quoted lines
> On 25/07/16 07:38AM, Patrick Steinhardt wrote: > > On Tue, Jul 15, 2025 at 02:15:07PM -0500, Justin Tobler wrote: > > > Also, as mentioned in a comment for the previous patch, maybe we should > > > support printing two output modes. For the default output, maybe a > > > simple `<key>=<value>\n` where the any value containing special > > > characters is quoted via `quote_c_style()`. > > > > > > A null-terminated output, such as the one proposed in this patch, could > > > be enabled via a `-z` flag similar to how its done in other commands. > > > > Agreed in general, but instead of using `-z` I wonder whether it would > > make sense to use something like `--format=key-value` and `--format=nul` > > instead. This gives us more room to introduce additional formats in the > > future, like for example the JSON format that was scrapped for now. > > If we already plan to support additional output formats, they I agree we > should probably a `--format=<output-type>` flag from the start. I still > think it would be nice to have a `-z` flag that is shorthand for > `--format=nul` though as that is fairly common across other commands to > have such an option. > > Out of curiousity, is there a reason we are interested in supporting a > JSON output format in addition to what is already proposed? From an > earlier conversation I had with Lucas, it didn't seem like there was any > particular reason for JSON.
I don't care much about the JSON output format. What I do care about is to have a default format that we are free to iterate on, especially in the context of `git repo size`. If we ever want to have output that is as user friendly as git-sizer(1)'s we need to have that freedom.
From my perspective that necessitates two things:
- That we are able to change formats with a proper `--format=` flag.
`-z` alone doesn't fit that bill, as we are already talking about
there formats: user friendly, key-value pairs, and key-value pairs
with NUL termination. That being said I'm not opposed to also have `-z` as an alias as
long as we also have `--format=`. - That the _default_ format is the user friendly format that we can
iterate on, at least for `git repo size`. Otherwise we have already
failed on our mission to supply a user-friendly alternative to
git-sizer(1).Patrick