@matheusbsbs / matheus-bagliano / commits / 110c46a909
Fork 0

Not all systems use st_[cm]tim field for ns resolution file timestamp

Some codepaths do not still use the ST_[CM]TIME_NSEC() pair of macros introduced by the previous commit but assumes all systems use st_mtim and st_ctim fields in "struct stat" to record nanosecond resolution part of the file timestamps. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Mar 8, 2009 at 13:51 UTC 110c46a909fe27f5b8aff412a78cb821300fb985
2 files changed +3 -3
builtin-fetch-pack.c
+1 -1
@@ -807,7 +807,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
807 die("shallow file was removed during fetch");
808 } else if (st.st_mtime != mtime.sec
809 #ifdef USE_NSEC
810 - || st.st_mtim.tv_nsec != mtime.nsec
810 + || ST_CTIME_NSEC(st) != mtime.nsec
811 #endif
812 )
813 die("shallow file was changed during fetch");
read-cache.c
+2 -2
@@ -204,9 +204,9 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
204 changed |= CTIME_CHANGED;
205
206 #ifdef USE_NSEC
207 - if (ce->ce_mtime.nsec != (unsigned int)st->st_mtim.tv_nsec)
207 + if (ce->ce_mtime.nsec != ST_MTIME_NSEC(*st))
208 changed |= MTIME_CHANGED;
209 - if (trust_ctime && ce->ce_ctime.nsec != (unsigned int)st->st_ctim.tv_nsec)
209 + if (trust_ctime && ce->ce_ctime.nsec != ST_CTIME_NSEC(*st))
210 changed |= CTIME_CHANGED;
211 #endif
212