Skip to content

Commit 85b960d

Browse files
dschoGit for Windows Build Agent
authored andcommitted
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 <[email protected]>
1 parent 88a1d3c commit 85b960d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

config.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,6 +2518,12 @@ int git_config_get_max_percent_split_change(void)
25182518

25192519
int repo_config_get_fsmonitor(struct repository *r)
25202520
{
2521+
if (!r->worktree) {
2522+
/* FSMonitor makes no sense in bare repositories */
2523+
core_fsmonitor = NULL;
2524+
return 1;
2525+
}
2526+
25212527
if (r->settings.use_builtin_fsmonitor > 0) {
25222528
core_fsmonitor = "(built-in daemon)";
25232529
return 1;

0 commit comments

Comments
 (0)