Brian Gernhardt <benji@xxxxxxxxxxxxxxxxxx> writes: > 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. Yeah, that was my initial reaction. Any BSDers? > diff --git a/git-compat-util.h b/git-compat-util.h > index 83d8389..1906253 100644 > --- a/git-compat-util.h > +++ b/git-compat-util.h > @@ -393,8 +393,13 @@ void git_qsort(void *base, size_t nmemb, size_t size, > #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 Thanks. I think this patch moves things in the right direction, but there are other uses of "st_[cm]tim.tv_nsec" that do not use the ST_[CM]TIME_NSEC macro. $ git grep -n -e 'st_[cm]tim\.' --cached -- '*.[ch]' builtin-fetch-pack.c:810: || st.st_mtim.tv_nsec != mtime.nsec git-compat-util.h:396:#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctim.tv_nsec)) git-compat-util.h:397:#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtim.tv_nsec)) read-cache.c:207: if (ce->ce_mtime.nsec != (unsigned int)st->st_mtim.tv_nsec) read-cache.c:209: if (trust_ctime && ce->ce_ctime.nsec != (unsigned int)st->st_ctim.tv_nsec) Probably we should apply the following patch as a fix, and then apply your enhancement to support st_[cm]timespec systems? builtin-fetch-pack.c | 2 +- read-cache.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c index 59b0b0a..1d7e023 100644 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@ -807,7 +807,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args, die("shallow file was removed during fetch"); } else if (st.st_mtime != mtime.sec #ifdef USE_NSEC - || st.st_mtim.tv_nsec != mtime.nsec + || ST_CTIME_NSEC(st) != mtime.nsec #endif ) die("shallow file was changed during fetch"); diff --git a/read-cache.c b/read-cache.c index b819abb..7f74c8d 100644 --- a/read-cache.c +++ b/read-cache.c @@ -204,9 +204,9 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) changed |= CTIME_CHANGED; #ifdef USE_NSEC - if (ce->ce_mtime.nsec != (unsigned int)st->st_mtim.tv_nsec) + if (ce->ce_mtime.nsec != ST_MTIME_NSEC(*st)) changed |= MTIME_CHANGED; - if (trust_ctime && ce->ce_ctime.nsec != (unsigned int)st->st_ctim.tv_nsec) + if (trust_ctime && ce->ce_ctime.nsec != ST_CTIME_NSEC(*st)) changed |= CTIME_CHANGED; #endif -- 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