git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v1] fsmonitor: force index write after full scan

From
Ben Peart <benpeart@microsoft.com>
Date
Apr 10, 2018, 18:14 UTC
Message-ID
<20180410181431.21024-1-benpeart@microsoft.com>

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 <benpeart@microsoft.com>
---
Notes:
    Base Ref:
    Web-Diff: https://github.com/benpeart/git/commit/4d39ddc2f9
    Checkout: git fetch https://github.com/benpeart/git fsmonitor-perf-v1 && git checkout 4d39ddc2f9
 fsmonitor.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/fsmonitor.c b/fsmonitor.c
index eb4e642256..ed3d1a074d 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -185,6 +185,9 @@ void refresh_fsmonitor(struct index_state *istate)
 		for (i = 0; i < istate->cache_nr; i++)
 			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 (istate->untracked)
 			istate->untracked->use_fsmonitor = 0;
 	}

base-commit: 0ac4dfac5000ef8de7966a3b7229275567d2d707
-- 
2.17.0.windows.1
Message 1 of 1 in “fsmonitor: force index write after full scan”
  1. fsmonitor: force index write after full scanBen Peart, Apr 10, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.