mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-03 00:43:41 +00:00
cmake: add USE_NSEC, and only check nanosec m/ctime if enabled
This commit is contained in:
parent
cdef1fad36
commit
e7de893ef8
@ -37,6 +37,7 @@ OPTION( LIBGIT2_FILENAME "Name of the produced binary" OFF )
|
||||
OPTION( USE_ICONV "Link with and use iconv library" OFF )
|
||||
OPTION( USE_SSH "Link with libssh to enable SSH support" ON )
|
||||
OPTION( USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF )
|
||||
OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes" OFF )
|
||||
OPTION( VALGRIND "Configure build for valgrind" OFF )
|
||||
OPTION( CURL "User curl for HTTP if available" ON)
|
||||
|
||||
@ -500,6 +501,10 @@ IF (THREADSAFE)
|
||||
ADD_DEFINITIONS(-DGIT_THREADS)
|
||||
ENDIF()
|
||||
|
||||
IF (USE_NSEC)
|
||||
ADD_DEFINITIONS(-DGIT_USE_NSEC)
|
||||
ENDIF()
|
||||
|
||||
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
|
||||
|
||||
# Collect sourcefiles
|
||||
|
@ -835,7 +835,11 @@ static int maybe_modified(
|
||||
*/
|
||||
} else if (git_oid_iszero(&nitem->id) && new_is_workdir) {
|
||||
bool use_ctime = ((diff->diffcaps & GIT_DIFFCAPS_TRUST_CTIME) != 0);
|
||||
#ifdef GIT_USE_NSEC
|
||||
bool use_nanos = ((diff->diffcaps & GIT_DIFFCAPS_TRUST_NANOSECS) != 0);
|
||||
#else
|
||||
bool use_nanos = false;
|
||||
#endif
|
||||
git_index *index;
|
||||
git_iterator_index(&index, info->new_iter);
|
||||
|
||||
|
@ -858,8 +858,11 @@ void git_index_entry__init_from_stat(
|
||||
{
|
||||
entry->ctime.seconds = (git_time_t)st->st_ctime;
|
||||
entry->mtime.seconds = (git_time_t)st->st_mtime;
|
||||
/* entry->mtime.nanoseconds = st->st_mtimensec; */
|
||||
/* entry->ctime.nanoseconds = st->st_ctimensec; */
|
||||
#if !defined(GIT_WIN32) && !defined(__APPLE__)
|
||||
/* Apple and Windows doesn't provide these struct stat fields. */
|
||||
entry->mtime.nanoseconds = st->st_mtim.tv_nsec;
|
||||
entry->ctime.nanoseconds = st->st_ctim.tv_nsec;
|
||||
#endif
|
||||
entry->dev = st->st_rdev;
|
||||
entry->ino = st->st_ino;
|
||||
entry->mode = (!trust_mode && S_ISREG(st->st_mode)) ?
|
||||
|
@ -163,9 +163,15 @@ static void hack_index(char *files[])
|
||||
cl_git_pass(p_stat(path.ptr, &statbuf));
|
||||
|
||||
entry->ctime.seconds = (git_time_t)statbuf.st_ctime;
|
||||
entry->ctime.nanoseconds = 0;
|
||||
entry->mtime.seconds = (git_time_t)statbuf.st_mtime;
|
||||
#if !defined(GIT_WIN32) && !defined(__APPLE__)
|
||||
/* Apple and Windows doesn't provide these struct stat fields. */
|
||||
entry->ctime.nanoseconds = statbuf.st_ctim.tv_nsec;
|
||||
entry->mtime.nanoseconds = statbuf.st_mtim.tv_nsec;
|
||||
#else
|
||||
entry->ctime.nanoseconds = 0;
|
||||
entry->mtime.nanoseconds = 0;
|
||||
#endif
|
||||
entry->dev = statbuf.st_dev;
|
||||
entry->ino = statbuf.st_ino;
|
||||
entry->uid = statbuf.st_uid;
|
||||
|
Loading…
Reference in New Issue
Block a user