Re: [PATCH] Implement fast hash-collision detection
From: Shawn Pearce <hidden>
Date: 2016-06-15 22:52:32
On Tue, Nov 29, 2011 at 05:17, Nguyen Thai Ngoc Duy [off-list ref] wrote:
On Tue, Nov 29, 2011 at 4:07 PM, Jeff King [off-list ref] wrote:quoted
However, it's harder for trees. Each entry needs to have the new digest added, but there simply isn't room in the format. So we would have to change the tree format, breaking interoperability with older versions of git. And all of your tree sha1's would change as soon as you wrote them with the new format. That's only slightly better than just swapping sha1 out for a better algorithm.I think we could hide the new digest after NUL at the end of path name. C Git at least does not seem to care whatever after NUL.
No, you can't. The next byte after the NUL at the end of a path name is the SHA-1 of that entry. After those 20 bytes of SHA-1 data is consumed, the "mode SP name\0" of the next entry is parsed. There is not room in the tree format for any additional data. Period. At best you can modify the mode value to be a new octal code that is not recognized by current Git implementations. But that doesn't get you a whole lot of data, and its pretty risky change because its rather incompatible.