Re: git bugs
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:44:43
On Tue, 10 Jun 2008, Ben Lynn wrote:
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