diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index 4f6e519bc0..0210f330d7 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -71,7 +71,7 @@ git by avoiding unnecessary scanning of files that have not changed. + See the "fsmonitor-watchman" section of linkgit:githooks[5]. + -Note: The value of this config setting is ignored if the +Note: The value of this config setting is ignored if the (experimental) built-in file system monitor is enabled (see `core.useBuiltinFSMonitor`). core.fsmonitorHookVersion:: @@ -91,7 +91,7 @@ Note: The value of this config setting is ignored if the built-in file system monitor is enabled (see `core.useBuiltinFSMonitor`). core.useBuiltinFSMonitor:: - If set to true, enable the built-in file system monitor + (EXPERIMENTAL) If set to true, enable the built-in file system monitor daemon for this working directory (linkgit:git-fsmonitor--daemon[1]). + Like hook-based file system monitors, the built-in file system monitor diff --git a/Documentation/git-fsmonitor--daemon.txt b/Documentation/git-fsmonitor--daemon.txt index 154e7684da..cf1d4556a5 100644 --- a/Documentation/git-fsmonitor--daemon.txt +++ b/Documentation/git-fsmonitor--daemon.txt @@ -3,7 +3,7 @@ git-fsmonitor--daemon(1) NAME ---- -git-fsmonitor--daemon - A Built-in File System Monitor +git-fsmonitor--daemon - (EXPERIMENTAL) A Built-in File System Monitor SYNOPSIS -------- @@ -16,6 +16,9 @@ SYNOPSIS DESCRIPTION ----------- +NOTE! This command is still only an experiment, subject to change dramatically +(or even to be abandoned). + A daemon to watch the working directory for file and directory changes using platform-specific file system notification facilities. diff --git a/repo-settings.c b/repo-settings.c index 935a4f3915..c3671e10e6 100644 --- a/repo-settings.c +++ b/repo-settings.c @@ -2,7 +2,8 @@ #include "config.h" #include "repository.h" #include "midx.h" -#include "compat/fsmonitor/fsm-listen.h" +#include "fsmonitor-ipc.h" +#include "fsmonitor-settings.h" static void repo_cfg_bool(struct repository *r, const char *key, int *dest, int def) @@ -36,6 +37,29 @@ void prepare_repo_settings(struct repository *r) /* Defaults modified by feature.* */ if (experimental) { r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_SKIPPING; + + /* + * Force enable the builtin FSMonitor (unless the repo + * is incompatible or they've already selected it or + * the hook version). But only if they haven't + * explicitly turned it off -- so only if our config + * value is UNSET. + * + * lookup_fsmonitor_settings() and check_for_ipc() do + * not distinguish between explicitly set FALSE and + * UNSET, so we re-test for an UNSET config key here. + * + * I'm not sure I want to fix fsmonitor-settings.c to + * have more than one _DISABLED state since our usage + * here is only to support this experimental period + * (and I don't want to overload the _reason field + * because it describes incompabilities). + */ + if (manyfiles && + fsmonitor_ipc__is_supported() && + fsm_settings__get_mode(r) == FSMONITOR_MODE_DISABLED && + repo_config_get_bool(r, "core.usebuiltinfsmonitor", &value)) + fsm_settings__set_ipc(r); } if (manyfiles) { r->settings.index_version = 4;