From 8612e585df9f11c2785a46f241532f3fcd1f47dc Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 28 Apr 2021 22:45:38 +0200 Subject: [PATCH] fsmonitor: only enable it in non-bare repositories The entire point of the FSMonitor is to monitor the worktree changes in a more efficient manner than `lstat()`ing all worktree files every time we refresh the index. But if there is no worktree, FSMonitor has nothing to monitor. So let's ignore if an FSMonitor is configured (e.g. in `~/.gitconfig`) and we're running in a repository without worktree. Signed-off-by: Johannes Schindelin --- config.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config.c b/config.c index 3621d176f8abfc..733aa82a0f6ba5 100644 --- a/config.c +++ b/config.c @@ -2519,6 +2519,12 @@ int git_config_get_max_percent_split_change(void) int repo_config_get_fsmonitor(struct repository *r) { + if (!r->worktree) { + /* FSMonitor makes no sense in bare repositories */ + core_fsmonitor = NULL; + return 1; + } + if (r->settings.use_builtin_fsmonitor > 0) { core_fsmonitor = "(built-in daemon)"; return 1;