[PATCH 2/2] read-cache.c: fix timestamp comparison

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---

 * 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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux