From: Justin Tobler <jltobler@gmail.com>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, karthik.188@gmail.com
Subject: Re: [RFC PATCH] diff: add option to report binary files in raw diffs
Date: Fri, 7 Nov 2025 11:16:35 -0600 [thread overview]
Message-ID: <ikzwvvyyhuhvr7picunl3r4zem4cn566zpjxpmh6u4oq6ncswa@cdfokimobtms> (raw)
In-Reply-To: <20251107083015.GA18670@tb-raspi4>
On 25/11/07 09:30AM, Torsten Bögershausen wrote:
> On Thu, Nov 06, 2025 at 03:42:49PM -0600, Justin Tobler wrote:
> > On 25/11/05 12:04AM, Junio C Hamano wrote:
> > > Justin Tobler <jltobler@gmail.com> writes:
> > Currently the output in the next version will look like:
> >
> > :100644 100644 a1961526 e231acb1 binary=yy M foo
> > :100644 100644 31eedd5c 402a70d7 binary=nn M bar
> >
>
> I think that is a good solutution ;-)
> When I once developped the
> git ls-files --eol option someone (Junio ?) convinced my to
> use a TAB as a seperator.
> In this case just before the filename:
>
> git ls-file --eol | xxd
> 00000000: 692f 6c66 2020 2020 772f 6c66 2020 2020 i/lf w/lf
> 00000010: 6174 7472 2f20 2020 2020 2020 2020 2020 attr/
> 00000020: 2020 2020 2020 092e 6369 7272 7573 2e79 ..cirrus.y
> ^^
> 00000030: 6d6c 0a ml.
>
> This makes the output both human readable and machine parsable:
> All info is before the TAB here. (And may be parsed again in a second
> round, if needed).
> Thoughts ?
So the raw diff format for a normal diff pair is as follows:
:<src mode>SP<dst mode>SP<src sha>SP<dest sha>SP<status>[score]TAB<src path>[TAB<dest path>]LF
When the `-z` option is used, tab and LF are replaced with a NUL byte.
So we do already use a tab to delimit between the score/paths. If we
wanted to drop avoid using comma to delimit between extended raw diff
output we could use a space instead and use TAB to indicate the end.
Maybe something like:
:100644 100644 a1961526 e231acb1 binary=yy crlf=nn M foo
:100644 100644 31eedd5c 402a70d7 binary=nn crlf=yy M bar
or we could maybe move the extended info towards the start of the line
and leave the remaining bits the same:
:binary=yy crlf=nn 100644 100644 a1961526 e231acb1 M foo
:binary=nn crlf=yy 100644 100644 31eedd5c 402a70d7 M bar
With either of these formats, the expectation would be parsers continue
reading space delimited "key=value" pairs until they encounter a tab. I
do think this latter format looks a bit nicer and I don't think it would
meaningfully impact the complexity of the parser. Ultimately, I don't
feel super strongly one way or the other though. I may go with this last
format in the next version since it does look a little nicer IMO. I'm
still very much interested in folks thoughts here though. :)
Thanks,
-Justin
next prev parent reply other threads:[~2025-11-07 17:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 2:14 [RFC PATCH] diff: add option to report binary files in raw diffs Justin Tobler
2025-11-04 2:26 ` Junio C Hamano
2025-11-04 4:44 ` Junio C Hamano
2025-11-05 0:17 ` Justin Tobler
2025-11-05 8:04 ` Junio C Hamano
2025-11-06 21:42 ` Justin Tobler
2025-11-07 8:30 ` Torsten Bögershausen
2025-11-07 16:07 ` Junio C Hamano
2025-11-07 17:16 ` Justin Tobler [this message]
2025-11-07 17:26 ` Junio C Hamano
2025-11-05 12:14 ` Ben Knoble
2025-11-06 21:52 ` Justin Tobler
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ikzwvvyyhuhvr7picunl3r4zem4cn566zpjxpmh6u4oq6ncswa@cdfokimobtms \
--to=jltobler@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=karthik.188@gmail.com \
--cc=tboegi@web.de \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).