Skip to content

Commit 013d416

Browse files
Merge pull request #7 from julianmesa-gitkraken/fix-nanoseconds-on-no-nanoseconds-repos
Fix degraded performance using GIT_USE_NSEC on repos cloned with GIT_USE_NSEC disabled
2 parents fe44f25 + e78ee33 commit 013d416

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/index.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ GIT_INLINE(bool) git_index_time_eq(const git_index_time *one, const git_index_ti
8484
return false;
8585

8686
#ifdef GIT_USE_NSEC
87+
if (one->nanoseconds == 0 || two->nanoseconds == 0)
88+
return true;
8789
if (one->nanoseconds != two->nanoseconds)
8890
return false;
8991
#endif
@@ -109,6 +111,8 @@ GIT_INLINE(bool) git_index_entry_newer_than_index(
109111
return true;
110112
else if ((int32_t)index->stamp.mtime.tv_sec > entry->mtime.seconds)
111113
return false;
114+
else if (entry->mtime.nanoseconds == 0 || index->stamp.mtime.tv_sec == 0)
115+
return true;
112116
else
113117
return (uint32_t)index->stamp.mtime.tv_nsec <= entry->mtime.nanoseconds;
114118
#else

0 commit comments

Comments
 (0)