summaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/index.c b/src/index.c
index 9eb1289c3..b3fb077cc 100644
--- a/src/index.c
+++ b/src/index.c
@@ -767,7 +767,8 @@ static int truncate_racily_clean(git_index *index)
diff_opts.flags |= GIT_DIFF_INCLUDE_TYPECHANGE | GIT_DIFF_IGNORE_SUBMODULES | GIT_DIFF_DISABLE_PATHSPEC_MATCH;
git_vector_foreach(&index->entries, i, entry) {
- if (!is_racy_timestamp(&index->stamp.mtime, entry))
+ if ((entry->flags_extended & GIT_IDXENTRY_UPTODATE) == 0 &&
+ is_racy_timestamp(&index->stamp.mtime, entry))
git_vector_insert(&paths, (char *)entry->path);
}
@@ -1295,6 +1296,9 @@ static int index_insert(
else
entry->flags |= GIT_IDXENTRY_NAMEMASK;
+ /* this entry is now up-to-date and should not be checked for raciness */
+ entry->flags_extended |= GIT_IDXENTRY_UPTODATE;
+
if (git_mutex_lock(&index->lock) < 0) {
giterr_set(GITERR_OS, "Unable to acquire index lock");
return -1;
@@ -2558,7 +2562,8 @@ static int write_disk_entry(git_filebuf *file, git_index_entry *entry)
if (entry->flags & GIT_IDXENTRY_EXTENDED) {
struct entry_long *ondisk_ext;
ondisk_ext = (struct entry_long *)ondisk;
- ondisk_ext->flags_extended = htons(entry->flags_extended);
+ ondisk_ext->flags_extended = htons(entry->flags_extended &
+ GIT_IDXENTRY_EXTENDED_FLAGS);
path = ondisk_ext->path;
}
else