Skip to content

Commit d57dbaf

Browse files
jeffhostetlerdscho
authored andcommitted
Merge branch 'mark-v4-fsmonitor-experimental' into try-v4-fsmonitor
2 parents e742ecc + e199da3 commit d57dbaf

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

Documentation/config/core.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ git by avoiding unnecessary scanning of files that have not changed.
7171
+
7272
See the "fsmonitor-watchman" section of linkgit:githooks[5].
7373
+
74-
Note: The value of this config setting is ignored if the
74+
Note: The value of this config setting is ignored if the (experimental)
7575
built-in file system monitor is enabled (see `core.useBuiltinFSMonitor`).
7676

7777
core.fsmonitorHookVersion::
@@ -91,7 +91,7 @@ Note: The value of this config setting is ignored if the
9191
built-in file system monitor is enabled (see `core.useBuiltinFSMonitor`).
9292

9393
core.useBuiltinFSMonitor::
94-
If set to true, enable the built-in file system monitor
94+
(EXPERIMENTAL) If set to true, enable the built-in file system monitor
9595
daemon for this working directory (linkgit:git-fsmonitor--daemon[1]).
9696
+
9797
Like hook-based file system monitors, the built-in file system monitor

Documentation/git-fsmonitor--daemon.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ git-fsmonitor--daemon(1)
33

44
NAME
55
----
6-
git-fsmonitor--daemon - A Built-in File System Monitor
6+
git-fsmonitor--daemon - (EXPERIMENTAL) A Built-in File System Monitor
77

88
SYNOPSIS
99
--------
@@ -16,6 +16,9 @@ SYNOPSIS
1616
DESCRIPTION
1717
-----------
1818

19+
NOTE! This command is still only an experiment, subject to change dramatically
20+
(or even to be abandoned).
21+
1922
A daemon to watch the working directory for file and directory
2023
changes using platform-specific file system notification facilities.
2124

repo-settings.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
#include "config.h"
33
#include "repository.h"
44
#include "midx.h"
5-
#include "compat/fsmonitor/fsm-listen.h"
5+
#include "fsmonitor-ipc.h"
6+
#include "fsmonitor-settings.h"
67

78
#define UPDATE_DEFAULT_BOOL(s,v) do { if (s == -1) { s = v; } } while(0)
89

910
void prepare_repo_settings(struct repository *r)
1011
{
11-
int value;
12+
int value, feature_many_files = 0;
1213
char *strval;
1314

1415
if (r->settings.initialized)
@@ -62,6 +63,7 @@ void prepare_repo_settings(struct repository *r)
6263
UPDATE_DEFAULT_BOOL(r->settings.core_multi_pack_index, 1);
6364

6465
if (!repo_config_get_bool(r, "feature.manyfiles", &value) && value) {
66+
feature_many_files = 1;
6567
UPDATE_DEFAULT_BOOL(r->settings.index_version, 4);
6668
UPDATE_DEFAULT_BOOL(r->settings.core_untracked_cache, UNTRACKED_CACHE_WRITE);
6769
}
@@ -70,9 +72,33 @@ void prepare_repo_settings(struct repository *r)
7072
r->settings.fetch_write_commit_graph = value;
7173
UPDATE_DEFAULT_BOOL(r->settings.fetch_write_commit_graph, 0);
7274

73-
if (!repo_config_get_bool(r, "feature.experimental", &value) && value)
75+
if (!repo_config_get_bool(r, "feature.experimental", &value) && value) {
7476
UPDATE_DEFAULT_BOOL(r->settings.fetch_negotiation_algorithm, FETCH_NEGOTIATION_SKIPPING);
7577

78+
/*
79+
* Force enable the builtin FSMonitor (unless the repo
80+
* is incompatible or they've already selected it or
81+
* the hook version). But only if they haven't
82+
* explicitly turned it off -- so only if our config
83+
* value is UNSET.
84+
*
85+
* lookup_fsmonitor_settings() and check_for_ipc() do
86+
* not distinguish between explicitly set FALSE and
87+
* UNSET, so we re-test for an UNSET config key here.
88+
*
89+
* I'm not sure I want to fix fsmonitor-settings.c to
90+
* have more than one _DISABLED state since our usage
91+
* here is only to support this experimental period
92+
* (and I don't want to overload the _reason field
93+
* because it describes incompabilities).
94+
*/
95+
if (feature_many_files &&
96+
fsmonitor_ipc__is_supported() &&
97+
fsm_settings__get_mode(r) == FSMONITOR_MODE_DISABLED &&
98+
repo_config_get_bool(r, "core.usebuiltinfsmonitor", &value))
99+
fsm_settings__set_ipc(r);
100+
}
101+
76102
/* Hack for test programs like test-dump-untracked-cache */
77103
if (ignore_untracked_cache_config)
78104
r->settings.core_untracked_cache = UNTRACKED_CACHE_KEEP;

0 commit comments

Comments
 (0)