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

[Question] Signature calculation ignoring parts of binary files

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Sep 12, 2018, 19:16 UTC
Message-ID
<003901d44acd$12c2bb90$384832b0$@nexbridge.com>
I feel really bad asking this, and I should know the answer, and yet.

I have a binary file that needs to go into a repo intact (unchanged). I also have a program that interprets the contents, like a textconv, that can output the relevant portions of the file in whatever format I like - used for diff typically, dumps in 1K chunks by file section. What I'm looking for is to have the SHA1 signature calculated with just the relevant portions of the file so that two actually different files will be considered the same by git during a commit or status. In real terms, I'm trying to ignore the Creator metadata of a JPG because it is mutable and irrelevant to my repo contents.

I'm sorry to ask, but I thought this was in .gitattributes but I can't confirm the SHA1 behaviour.

Sheepishly, Randall

-- Brief whoami:
 NonStop developer since approximately 211288444200000000
 UNIX developer since approximately 421664400
-- In my real life, I talk too much.
Next: Johannes Sixt
Message 1 of 10 in “[Question] Signature calculation ignoring parts of binary files”
  1. Randall S. BeckerSep 12, 2018
  2. Johannes SixtSep 12, 2018
  3. Randall S. BeckerSep 12, 2018
  4. Randall S. BeckerSep 12, 2018
  5. Junio C HamanoSep 12, 2018
  6. Randall S. BeckerSep 13, 2018
  7. Junio C HamanoSep 13, 2018
  8. Randall S. BeckerSep 13, 2018
  9. Junio C HamanoSep 13, 2018
  10. Randall S. BeckerSep 13, 2018

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.