Skip to content

Commit 9222306

Browse files
vdyedscho
andcommitted
scalar: upgrade to newest FSMonitor config setting
When FSMonitor was upstreamed, the 'core.useBuiltinFSMonitor' config was deprecated and replaced with an overload of the 'core.fsmonitor' config (i.e., if a boolean value was specified in 'core.fsmonitor', it is treated the way 'core.useBuiltinFSMonitor' originally was). Because 'scalar register' actively sets that config, use it to upgrade the deprecated config setting. Co-authored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Victoria Dye <vdye@github.com>
1 parent eb52c97 commit 9222306

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

scalar.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,23 @@ static int set_recommended_config(int reconfigure)
202202
int i;
203203
char *value;
204204

205+
/*
206+
* If a user has "core.usebuiltinfsmonitor" enabled, try to switch to
207+
* the new (non-deprecated) setting (core.fsmonitor).
208+
*/
209+
if (!repo_config_get_string(the_repository, "core.usebuiltinfsmonitor", &value)) {
210+
char *dummy = NULL;
211+
if (repo_config_get_string(the_repository, "core.fsmonitor", &dummy) &&
212+
repo_config_set_gently(the_repository, "core.fsmonitor", value) < 0)
213+
return error(_("could not configure %s=%s"),
214+
"core.fsmonitor", value);
215+
if (repo_config_set_gently(the_repository, "core.usebuiltinfsmonitor", NULL) < 0)
216+
return error(_("could not configure %s=%s"),
217+
"core.useBuiltinFSMonitor", "NULL");
218+
free(value);
219+
free(dummy);
220+
}
221+
205222
for (i = 0; config[i].key; i++) {
206223
if (set_scalar_config(config + i, reconfigure))
207224
return error(_("could not configure %s=%s"),

0 commit comments

Comments
 (0)