Skip to content

Commit

Permalink
Not all systems use st_[cm]tim field for ns resolution file timestamp
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Mar 8, 2009
1 parent c06ff49 commit 110c46a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion builtin-fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions read-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 110c46a

Please sign in to comment.