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
910void 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