Re: [PATCH] Implement fast hash-collision detection
- From
Shawn Pearce <spearce@spearce.org>
- Date
- Nov 29, 2011, 15:23 UTC
- Message-ID
- <CAJo=hJvavm6feUjxOZ-qvJjs0nT=uKtFqs1Z82rcyEqazFxUOg@mail.gmail.com>
- In-Reply-To
- <CACsJy8BRhoYM+Lb8afp=3rKzYNOEq0JY8uS9mD1ovz3uyJVWOA@mail.gmail.com>
On Tue, Nov 29, 2011 at 05:17, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
Show 10 quoted lines
> On Tue, Nov 29, 2011 at 4:07 PM, Jeff King <peff@peff.net> wrote: >> 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.