Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'fsmonitor.c')
-rw-r--r--fsmonitor.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/fsmonitor.c b/fsmonitor.c
index 0477500b39..868cca01e2 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -191,13 +191,26 @@ void refresh_fsmonitor(struct index_state *istate)
}
if (bol < query_result.len)
fsmonitor_refresh_callback(istate, buf + bol);
+
+ /* Now mark the untracked cache for fsmonitor usage */
+ if (istate->untracked)
+ istate->untracked->use_fsmonitor = 1;
} else {
+
+ /* We only want to run the post index changed hook if we've actually changed entries, so keep track
+ * if we actually changed entries or not */
+ int is_cache_changed = 0;
/* Mark all entries invalid */
- for (i = 0; i < istate->cache_nr; i++)
- istate->cache[i]->ce_flags &= ~CE_FSMONITOR_VALID;
+ for (i = 0; i < istate->cache_nr; i++) {
+ if (istate->cache[i]->ce_flags & CE_FSMONITOR_VALID) {
+ is_cache_changed = 1;
+ istate->cache[i]->ce_flags &= ~CE_FSMONITOR_VALID;
+ }
+ }
/* If we're going to check every file, ensure we save the results */
- istate->cache_changed |= FSMONITOR_CHANGED;
+ if (is_cache_changed)
+ istate->cache_changed |= FSMONITOR_CHANGED;
if (istate->untracked)
istate->untracked->use_fsmonitor = 0;
@@ -259,9 +272,7 @@ void tweak_fsmonitor(struct index_state *istate)
(uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
ewah_each_bit(istate->fsmonitor_dirty, fsmonitor_ewah_callback, istate);
- /* Now mark the untracked cache for fsmonitor usage */
- if (istate->untracked)
- istate->untracked->use_fsmonitor = 1;
+ refresh_fsmonitor(istate);
}
ewah_free(istate->fsmonitor_dirty);