Skip to content

Commit ca598d5

Browse files
benpeartgitster
authored andcommitted
fsmonitor: force index write after full scan
fsmonitor currently only flags the index as dirty if the extension is being added or removed. This is a performance optimization that recognizes you can stat() a lot of files in less time than it takes to write out an updated index. This patch makes a small enhancement and flags the index dirty if we end up having to stat() all files and scan the entire working directory. The assumption being that must be expensive or you would not have turned on the feature. Signed-off-by: Ben Peart <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8b026ed commit ca598d5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fsmonitor.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ void refresh_fsmonitor(struct index_state *istate)
185185
for (i = 0; i < istate->cache_nr; i++)
186186
istate->cache[i]->ce_flags &= ~CE_FSMONITOR_VALID;
187187

188+
/* If we're going to check every file, ensure we save the results */
189+
istate->cache_changed |= FSMONITOR_CHANGED;
190+
188191
if (istate->untracked)
189192
istate->untracked->use_fsmonitor = 0;
190193
}

0 commit comments

Comments
 (0)