Skip to content

Fix degraded performance using GIT_USE_NSEC on repos cloned with GIT_USE_NSEC disabled #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/index.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ GIT_INLINE(bool) git_index_time_eq(const git_index_time *one, const git_index_ti
return false;

#ifdef GIT_USE_NSEC
if (one->nanoseconds == 0 || two->nanoseconds == 0)
return true;
if (one->nanoseconds != two->nanoseconds)
return false;
#endif
Expand All @@ -109,6 +111,8 @@ GIT_INLINE(bool) git_index_entry_newer_than_index(
return true;
else if ((int32_t)index->stamp.mtime.tv_sec > entry->mtime.seconds)
return false;
else if (entry->mtime.nanoseconds == 0 || index->stamp.mtime.tv_sec == 0)
return true;
else
return (uint32_t)index->stamp.mtime.tv_nsec <= entry->mtime.nanoseconds;
#else
Expand Down