aboutsummaryrefslogtreecommitdiffstats
path: root/read-cache.c
diff options
context:
space:
mode:
authorPetr Baudis <pasky@ucw.cz>2005-04-13 02:20:38 -0700
committerPetr Baudis <xpasky@machine>2005-04-13 02:20:38 -0700
commitbdd4da595a265a091a859754a22688f7351cddee (patch)
treef519f8e9742f9e2f37cecdf3e93338d843471580 /read-cache.c
parent5c2a7fbc362e4227ced84c32c3fdc9682d085962 (diff)
downloadgit-bdd4da595a265a091a859754a22688f7351cddee.tar.gz
[PATCH] Make nsec checking optional
The nsec field of ctime/mtime is now checked only with -DNSEC defined during compilation. nsec acts broken since it is stored in the icache but apparently just gets to zero when flushed to filesystem not supporting it (e.g. ext3), creating illusions of false changes. At least that's my impression. Signed-off-by: Petr Baudis <pasky@ucw.cz>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/read-cache.c b/read-cache.c
index 2ee96bc92c..f1abae1442 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -250,11 +250,20 @@ int cache_match_stat(struct cache_entry *ce, struct stat *st)
{
unsigned int changed = 0;
- if (ce->mtime.sec != (unsigned int)st->st_mtim.tv_sec ||
- ce->mtime.nsec != (unsigned int)st->st_mtim.tv_nsec)
+ /* nsec seems unreliable - not all filesystems support it, so
+ * as long as it is in the inode cache you get right nsec
+ * but after it gets flushed, you get zero nsec. */
+ if (ce->mtime.sec != (unsigned int)st->st_mtim.tv_sec
+#ifdef NSEC
+ || ce->mtime.nsec != (unsigned int)st->st_mtim.tv_nsec
+#endif
+ )
changed |= MTIME_CHANGED;
- if (ce->ctime.sec != (unsigned int)st->st_ctim.tv_sec ||
- ce->ctime.nsec != (unsigned int)st->st_ctim.tv_nsec)
+ if (ce->ctime.sec != (unsigned int)st->st_ctim.tv_sec
+#ifdef NSEC
+ || ce->ctime.nsec != (unsigned int)st->st_ctim.tv_nsec
+#endif
+ )
changed |= CTIME_CHANGED;
if (ce->st_uid != (unsigned int)st->st_uid ||
ce->st_gid != (unsigned int)st->st_gid)