From 06755c32b53a4b65d8523d23527eac57a86d36cb 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 d8649cda05..772e6ee877 100644 --- a/config.c +++ b/config.c @@ -2518,6 +2518,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;