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

Re: [PATCH] Show binary file size change in diff --stat

From
APAndy Parkins <andyparkins@gmail.com>
Date
Apr 4, 2007, 14:40 UTC
Message-ID
<200704041540.59977.andyparkins@gmail.com>
In-Reply-To
<4613A974.60808@dawes.za.net>
On Wednesday 2007 April 04 14:34, Rogan Dawes wrote:
> Well, how about my comments in <45E67978.9030805@dawes.za.net>,
> suggesting that the edit difference (number of steps required to
> transform one to the other) would be a better indication?
Perhaps.  There is certainly a difference between:
 somefile.bin  | 1000 -> 1000 bytes
and
 somefile.bin  | 500 bytes removed, 500 bytes added
> I think it is better because it is consistent with what we currently do
> for text files: show the number of lines added/deleted.

The thing is, "lines" is an understandable unit for a text file, so it's useful to show. I'm not sure the same is true of "bytes" for a binary file. Those bytes could represent anything; the true unit of a binary file is dependent on its type.

> For binary files, it would be consistent to show the number of bytes
> added/deleted. I have not investigated the output format for the
> libxdiff binary patch format, but hopefully it would not be too
> difficult to calculate the deletions and additions.

I'm inclined to agree with Johannes, while it's certainly something that /could/ be shown - is it more useful? There is no guarantee that a small change in the underlying content is represented by a small change in the binary diff.

As an example: compress a file, change a byte, compress it again, perform a binary diff; what is that diff telling you about the change? (My answer is: not much).

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
Previous: Rogan DawesNext: Rogan Dawes
Message 5 of 12 in “Show binary file size change in diff --stat”
  1. Show binary file size change in diff --statAndy Parkins, Apr 4, 2007
  2. Rogan DawesApr 4, 2007
  3. Geert BoschApr 4, 2007
  4. Rogan DawesApr 4, 2007
  5. Andy ParkinsApr 4, 2007
  6. Rogan DawesApr 4, 2007
  7. Johannes SchindelinApr 4, 2007
  8. Rogan DawesApr 4, 2007
  9. Linus TorvaldsApr 4, 2007
  10. Johannes SchindelinApr 4, 2007
  11. Linus TorvaldsApr 4, 2007
  12. Junio C HamanoApr 4, 2007

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.