[PATCH 2/2] read-cache.c: fix timestamp comparison
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 21, 2008, 08:46 UTC
- Message-ID
- <7vzluzzhud.fsf_-_@gitster.siamese.dyndns.org>
- In-Reply-To
- <7v8x2j1sul.fsf@gitster.siamese.dyndns.org>
The mtime recorded in the cache entry is not time_t anymore but of type (unsigned int). This casts the comparison and also adds fuzz factor of 1 second.
Signed-off-by: Junio C Hamano <gitster@pobox.com> ---
* With these two patches the t7501 Heisenbug seems to go away. I do not understand why this fuzz factor of 1 second helps, but it apparently does. I do not want to commit this before I understand why, but it is past my bedtime.
read-cache.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/read-cache.c b/read-cache.c index 9554896..745c3fe 100644 --- a/read-cache.c +++ b/read-cache.c @@ -180,7 +180,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) static int is_racy_timestamp(struct index_state *istate, struct cache_entry *ce) { return (istate->timestamp && - istate->timestamp <= ce->ce_mtime); + ((unsigned int) istate->timestamp) <= ce->ce_mtime + 1); } int ie_match_stat(struct index_state *istate,
-- 1.5.4.rc4.5.g36a1