Re: git bugs
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Jun 11, 2008, 14:52 UTC
- Message-ID
- <alpine.LFD.1.10.0806110749230.3101@woody.linux-foundation.org>
- In-Reply-To
- <832adb090806102258v3fd63605p8c45513690b78fe8@mail.gmail.com>
On Tue, 10 Jun 2008, Ben Lynn wrote:
Show 7 quoted lines
>
> Am I going crazy? All of a sudden I think I can get away without a
> size zero hack. How about this smudging routine:
>
> if (!ce_match_stat_basic(ce, &st)) {
> recompute_sha1_and_update_index(); // no other checks required
> }No.
You can't recompute the sha1. That SHA1 is what the user asked us to remember - whether smudged or not. So you mustn't change it, until the user does a "git add" or "git update-index" (or anything that implicitly does the same).
You can change the _stat_ information, since that is only used for matching the tree (positively or negatively), but the SHA1 itself is not just a cache, it's the "pending state" in the index.
So smudging must change some piece of data that is only about the stat cache - the st_size, the mtime, anything like that.
Linus