summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 110c46a)
raw | patch | inline | side by side (parent: 110c46a)
author | Brian Gernhardt <benji@silverinsanity.com> | |
Sun, 8 Mar 2009 20:04:28 +0000 (16:04 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 8 Mar 2009 21:04:41 +0000 (14:04 -0700) |
Not all OSes use st_ctim and st_mtim in their struct stat. In
particular, it appears that OS X uses st_*timespec instead. So add a
Makefile variable and #define called USE_ST_TIMESPEC to switch the
USE_NSEC defines to use st_*timespec.
This also turns it on by default for OS X (Darwin) machines. Likely
this is a sane default for other BSD kernels as well, but I don't have
any to test that assumption on.
Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
particular, it appears that OS X uses st_*timespec instead. So add a
Makefile variable and #define called USE_ST_TIMESPEC to switch the
USE_NSEC defines to use st_*timespec.
This also turns it on by default for OS X (Darwin) machines. Likely
this is a sane default for other BSD kernels as well, but I don't have
any to test that assumption on.
Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile | patch | blob | history | |
git-compat-util.h | patch | blob | history |
diff --git a/Makefile b/Makefile
index 65b5b8a63f20624cbe1080d6e61e11a0fc1e4ef0..7b310859e97124376195c9bf7fcf4fe9b951d346 100644 (file)
--- a/Makefile
+++ b/Makefile
# randomly break unless your underlying filesystem supports those sub-second
# times (my ext3 doesn't).
#
+# Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
+# "st_ctim"
+#
# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
# available. This automatically turns USE_NSEC off.
#
endif
NO_MEMMEM = YesPlease
THREADED_DELTA_SEARCH = YesPlease
+ USE_ST_TIMESPEC = YesPlease
endif
ifeq ($(uname_S),SunOS)
NEEDS_SOCKET = YesPlease
ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
endif
+ifdef USE_ST_TIMESPEC
+ BASIC_CFLAGS += -DUSE_ST_TIMESPEC
+endif
ifdef NO_NSEC
BASIC_CFLAGS += -DNO_NSEC
endif
diff --git a/git-compat-util.h b/git-compat-util.h
index 9b495dcad849cc103c9b03699df8d33b7d871235..c915752a241397b3ba0310fec347c2042ed5e2af 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
#define ST_CTIME_NSEC(st) 0
#define ST_MTIME_NSEC(st) 0
#else
+#ifdef USE_ST_TIMESPEC
+#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctimespec.tv_nsec))
+#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtimespec.tv_nsec))
+#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
#endif