aboutsummaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorKjetil Barvik <barvik@broadpark.no>2009-03-04 18:47:40 +0100
committerJunio C Hamano <gitster@pobox.com>2009-03-07 20:25:16 -0800
commitc06ff4908bf9ad8bf2448439a3574321c9399b17 (patch)
tree269f1fcbb4c60ceeccdc4dcf1f270d1f3f72d977 /git-compat-util.h
parente1afca4fd3e7cb4000874e991277f10119de4ad2 (diff)
downloadgit-c06ff4908bf9ad8bf2448439a3574321c9399b17.tar.gz
git-c06ff4908bf9ad8bf2448439a3574321c9399b17.tar.xz
Record ns-timestamps if possible, but do not use it without USE_NSEC
Traditionally, the lack of USE_NSEC meant "do not record nor use the nanosecond resolution part of the file timestamps". To avoid problems on filesystems that lose the ns part when the metadata is flushed to the disk and then later read back in, disabling USE_NSEC has been a good idea in general. If you are on a filesystem without such an issue, it does not hurt to read and store them in the cached stat data in the index entries even if your git is compiled without USE_NSEC. The index left with such a version of git can be read by git compiled with USE_NSEC and it can make use of the nanosecond part to optimize the check to see if the path on the filesystem hsa been modified since we last looked at. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 079cbe944..9b495dcad 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -384,4 +384,13 @@ void git_qsort(void *base, size_t nmemb, size_t size,
# define FORCE_DIR_SET_GID 0
#endif
+#ifdef NO_NSEC
+#undef USE_NSEC
+#define ST_CTIME_NSEC(st) 0
+#define ST_MTIME_NSEC(st) 0
+#else
+#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctim.tv_nsec))
+#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtim.tv_nsec))
+#endif
+
#endif