Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
e7de893e
Commit
e7de893e
authored
Jun 01, 2015
by
Axel Rasmussen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: add USE_NSEC, and only check nanosec m/ctime if enabled
parent
cdef1fad
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
3 deletions
+21
-3
CMakeLists.txt
+5
-0
src/diff.c
+4
-0
src/index.c
+5
-2
tests/merge/workdir/dirty.c
+7
-1
No files found.
CMakeLists.txt
View file @
e7de893e
...
...
@@ -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
...
...
src/diff.c
View file @
e7de893e
...
...
@@ -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
);
...
...
src/index.c
View file @
e7de893e
...
...
@@ -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
))
?
...
...
tests/merge/workdir/dirty.c
View file @
e7de893e
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment