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

RFC: Separate commit identification from Merkle hashing

From
Eric S. Raymond <esr@thyrsus.com>
Date
May 21, 2019, 01:32 UTC
Message-ID
<20190521013250.3506B470485F@snark.thyrsus.com>

I have been thinking hard about the problems raised during my request for unique timestamps. I think I've found a better way to bust the box I was trying to break out of. I am therefore withdrawing that proposal and replacing it with this one.

It's time to separate commit identification from Merkle hashing.

One reason I am sure of this is the SHA-1 to whatever transition. We can't count on the successor hash to survive attack forever. Accordingly, git's design needs to be stable against the possibility of having to accommodate multiple future hash algorithms in the future.

Here's how to do it:
1. Commit IDs and Merkle-tree hashes become separate commit
   properties in the git filesystem.
2. The data structure representing a Merkle-tree hash becomes
   a pair consisting of a value and a hash-algorithm tag. An
   empty tag is interpreted as SHA-1. I will call this entity the
   "verification hash" and avoid unqualified use of "hash" in the
   rest of this proposal.
3. The initial value of a commit's ID in a live repository is a copy
   of its verification hash, except in one important case.
4. When a repository is exported to a stream, the commit-id is dumped
   with other commit metadata.  Thus, anything that can read a stream
   can resolve commit references in its change comments.
5. When a stream is imported, if a commit has a commit-id field it
   overrides the default assignment of the generated verification hash
   to that field.
6. Commit IDs are free-format and not interpreted by git except
   as lookup keys. When git changes verification-hash functions,
   commit IDs do not change.
Notice several important properties of this design.
A. Git becomes absolutely future-proofed against hash-algorithm
   changes. It can even support the use of multiple hash types over
   the lifetime of one repo.
B. All SHA-1 commit references will resolve forever even after git
   stops generating them.  All future hash-based commit references will
   also be good forever.
C. The id/verification split will be invisible from clients at start,
   because initially they coincide and will continue to do so unless
   an explicit decision changes either the verification-hash algorithm
   or the way commit-IDs are initialized.
D. My wish for forward-portable unique commit IDs is granted.
   They're not by default eyeball-friendly, but I can live with that.
   Furthermore, because they're preserved in streams they can be
   eternally stable even as hash algorithms and preferred ID
   formats change.
E. There is now a unique total order on the repo, modulo highly
   unlikely (and in priciple completely avoidable) commit-ID
   collisions. It's commit date tie-broken by commit-ID sort order.
   It too survives hash-function changes.
F. There's no need for timestamp uniqueness any more.
G. When a repository is imported from (say) Subversion, the Subversion
   IDs *don't have to break*!  They can be used to initialize the
   commit-ID fields. Many users migrating from other VCSes will be
   deeply, deeply grateful for this feature.

I believe this solves every problem I walked in with except timestamp truncation.

-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

Probably fewer than 2% of handguns and well under 1% of all guns will
ever be involved in a violent crime. Thus, the problem of criminal gun
violence is concentrated within a very small subset of gun owners,
indicating that gun control aimed at the general population faces a
serious needle-in-the-haystack problem.
	-- Gary Kleck, "Point Blank: Handgun Violence In America"
Next: Jonathan Nieder
Message 1 of 13 in “RFC: Separate commit identification from Merkle hashing”
  1. Eric S. RaymondMay 21, 2019
  2. Jonathan NiederMay 21, 2019
  3. Eric S. RaymondMay 21, 2019
  4. Jonathan NiederMay 21, 2019
  5. Eric S. RaymondMay 21, 2019
  6. Jakub NarebskiMay 23, 2019
  7. Jonathan NiederMay 23, 2019
  8. Eric S. RaymondMay 23, 2019
  9. Eric S. RaymondMay 23, 2019
  10. Jonathan NiederMay 23, 2019
  11. Eric S. RaymondMay 23, 2019
  12. Randall S. BeckerMay 23, 2019
  13. Ævar Arnfjörð BjarmasonMay 23, 2019

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.