summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5c2a7fb)
raw | patch | inline | side by side (parent: 5c2a7fb)
author | Petr Baudis <pasky@ucw.cz> | |
Wed, 13 Apr 2005 09:20:38 +0000 (02:20 -0700) | ||
committer | Petr Baudis <xpasky@machine> | |
Wed, 13 Apr 2005 09:20:38 +0000 (02:20 -0700) |
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>
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>
Makefile | patch | blob | history | |
read-cache.c | patch | blob | history |
diff --git a/Makefile b/Makefile
index ac61a61b0e99203bd757b8aab7e11fc550197855..c7e5c7467d603fcaad63ee2bcade0889c21015d8 100644 (file)
--- a/Makefile
+++ b/Makefile
# -DCOLLISION_CHECK if you believe that SHA1's
# 1461501637330902918203684832716283019655932542976 hashes do not give you
# enough guarantees about no collisions between objects ever hapenning.
+#
+# -DNSEC if you want git to care about sub-second file mtimes and ctimes.
+# Note that you need some new glibc (at least >2.2.4) for this, and it will
+# BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely randomly
+# break unless your underlying filesystem supports those sub-second times
+# (my ext3 doesn't).
CFLAGS=-g -O3 -Wall
CC=gcc
+
PROG= update-cache show-diff init-db write-tree read-tree commit-tree \
cat-file fsck-cache checkout-cache diff-tree rev-tree show-files \
check-files ls-tree
diff --git a/read-cache.c b/read-cache.c
index 2ee96bc92c37a204a844afb3354483b733db0c4e..f1abae1442e72753dc8356bcbdc860be9a645bc4 100644 (file)
--- a/read-cache.c
+++ b/read-cache.c
{
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)