Skip to content

Commit 0ce3f15

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 0f82573 commit 0ce3f15

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
@@ -2519,6 +2519,12 @@ int git_config_get_max_percent_split_change(void)
25192519

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

0 commit comments

Comments
 (0)