From: Ron Ziroby Romero <ziroby@gmail.com>
To: demerphq <demerphq@gmail.com>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
Sean Allred <allred.sean@gmail.com>,
git@vger.kernel.org
Subject: Re: Pretty output in JSON format
Date: Thu, 31 Jul 2025 21:19:05 +0100 [thread overview]
Message-ID: <CAGW8g7mjJ8+aRkg5nf1c6CCAWTnxery86uLuN-9n3nt_VDaZvA@mail.gmail.com> (raw)
In-Reply-To: <CAGW8g7=xK0S-i_Ekfwwo_NjMbngO_5m4LERtWRhSCgA0vf+ZAg@mail.gmail.com>
> On Fri, 27 Sept 2024, 10:30 demerphq, <demerphq@gmail.com> wrote:
>>
>> On Thu, 26 Sept 2024 at 23:04, brian m. carlson <sandals@crustytoothpaste.net> wrote:
>>>
>>> On 2024-09-25 at 18:45:54, Sean Allred wrote:
>>> > "brian m. carlson" <sandals@crustytoothpaste.net> writes:
>>> >
>>> > > On 2024-09-24 at 21:52:35, Ron Ziroby Romero wrote:
>>> > >> What do y'all think?
>>> > >
>>> > > I think this is ultimately a bad idea. JSON requires that the output be
>>> > > UTF-8, but Git processes a large amount of data, including file names,
>>> > > ref names, commit messages, author and committer identities, diff
>>> > > output, and other file contents, that are not restricted to UTF-8.
>>> >
>>> > This strikes me with a little bit of 'perfect as the enemy of good'
>>> > here. I'm sure there are ways to signal an encoding failure. I would,
>>> > however, caution against trying to provide diff output in JSON. That
>>> > just seems... odd. Maybe base64 it first? (I don't know -- I just
>>> > struggle to see the use-case here.)
>>>
>>> I understand JSON output would be useful, but it's also not useful to
>>> randomly fail to do git for-each-ref (for example) because someone has a
>>> non-UTF-8 ref, or to fail to do a git log because of encoding problems
>>
>>
>> I dont really follow your argument, and I find it weird how you are talking about a specific encoding of unicode instead of Unicode itself.
>>
>> It is possible to represent every binary string as Unicode encoded as UTF-8 (or any of the UTF encodings). It may not be bytewise equivalent with the original, but why should that matter? There are a set of clear rules for doing the required transformations, and there is a huge body of tooling to do so. As long as you know the target encoding, you should be able to round trip data properly.
>>
>> IMO CBOR would just complicate what should be a relatively simple problem to solve.
>>
>> cheers,
>> Yves
>>
>>
>>
>> --
>> perl -Mre=debug -e "/just|another|perl|hacker/"
Hi. I've been working with the code and trying to figure out how to do
this. I've also started work on a formal proposal. Two things have
come up that I wanted to discuss:
First, I'm questioning my approach of hacking pretty.c with a series
of 'if json' blocks. Would it be better to make a new file, json-log.,
and divorce myself from the pretty flow entirely? This would also go
hand in hand with changing from "--pretty=json" to simply "--json"
Second, I see that someone is adding a --json flag to git status[1]. I
figure that argues for git log to use the --json flag. I don't think
that affects me other than making the case for this JSON output.
## References
[1] Patrick Steinhardt, “Re: [PATCH] diff: add --json output format,”
message to git@vger.kernel.org, July 29, 2025.
https://public-inbox.org/git/pull.1937.git.1753856826464.gitgitgadget@gmail.com/
Thanks,
Ziroby Ron Romero
next prev parent reply other threads:[~2025-07-31 20:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 21:52 Pretty output in JSON format Ron Ziroby Romero
2024-09-24 22:06 ` brian m. carlson
2024-09-25 18:45 ` Sean Allred
2024-09-26 21:04 ` brian m. carlson
2024-09-27 6:49 ` Ron Ziroby Romero
[not found] ` <CANgJU+Xs-sQgAOCPL-5skaZGq7eHmhg0MaFGDr8N57=CK67iog@mail.gmail.com>
[not found] ` <CAGW8g7=xK0S-i_Ekfwwo_NjMbngO_5m4LERtWRhSCgA0vf+ZAg@mail.gmail.com>
2025-07-31 20:19 ` Ron Ziroby Romero [this message]
2025-08-04 20:39 ` Ron Ziroby Romero
2025-08-04 21:19 ` 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=CAGW8g7mjJ8+aRkg5nf1c6CCAWTnxery86uLuN-9n3nt_VDaZvA@mail.gmail.com \
--to=ziroby@gmail.com \
--cc=allred.sean@gmail.com \
--cc=demerphq@gmail.com \
--cc=git@vger.kernel.org \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).