git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH] diff: add option to report binary files in raw diffs

From
Justin Tobler <jltobler@gmail.com>
Date
Nov 6, 2025, 21:42 UTC
Message-ID
<z5mkdl67vx47na5critwtyz7cacvhs6iixy46ia3svdoq7xui5@ckpfnjw3dkoq>
In-Reply-To
<xmqqtsz8nbwv.fsf@gitster.g>
On 25/11/05 12:04AM, Junio C Hamano wrote:
Show 31 quoted lines
> Justin Tobler <jltobler@gmail.com> writes:
> 
> > Maybe the output should be something like:
> >
> >   binary=tt,incomplete=ic,crlf=cl
> >
> > or something along those lines. That way we could freely extend in the
> > future without having to worry about a specific order. If we think all
> > of the raw diff extension modes would only report with yes/no for each
> > file we could just do:
> >
> >   binary=yn,incomplete=yy,crlf=nn
> >
> > but maybe we should be more flexible and leave it up to the mode to
> > decide what its values can be?
> >
> > Also, maybe this info could be on a newline following each raw diff
> > entry? Something like:
> >
> >   :100644 100644 a1961526 e231acb1 M	foo
> >   binary=yy
> >   :100644 100644 31eedd5c 402a70d7 M	bar
> >   binary=nn
> 
> I know these are parse-able, but quite honestly, both sounds
> somewhat backwards, if you meant to make this easier to parse by
> simple scripts.  Scripts do not mind their input line wider than 80
> columns, but it is cumbersome if they have to take each pair of
> lines and combine them to process.  And repeated keywords like
> binary= etc., do not look like it is less error prone for scripts to
> parse them out, either.  So, I dunno.

Personally, while keywords like "binary=" add a bit of complexity to the output, I do like the idea of having the output be self-documenting that way the parsers can avoid being aware of the inputted arguments or some predetermined output order. I do agree though that spreading the output across multiple lines doesn't really help us much as it probably doesn't matter whether we split on a comma or a newline. It's probably simpler just to keep it all on a single line.

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

Thanks, -Justin

Previous: Junio C HamanoNext: Torsten Bögershausen
Message 6 of 12 in “diff: add option to report binary files in raw diffs”
  1. diff: add option to report binary files in raw diffsJustin Tobler, Nov 4, 2025
  2. Junio C HamanoNov 4, 2025
  3. Junio C HamanoNov 4, 2025
  4. Justin ToblerNov 5, 2025
  5. Junio C HamanoNov 5, 2025
  6. Justin ToblerNov 6, 2025
  7. Torsten BögershausenNov 7, 2025
  8. Junio C HamanoNov 7, 2025
  9. Justin ToblerNov 7, 2025
  10. Junio C HamanoNov 7, 2025
  11. Ben KnobleNov 5, 2025
  12. Justin ToblerNov 6, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.