Skip to content

Commit 70305e1

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 <[email protected]> Signed-off-by: Victoria Dye <[email protected]>
1 parent 1ff70b3 commit 70305e1

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
@@ -201,6 +201,23 @@ static int set_recommended_config(int reconfigure)
201201
int i;
202202
char *value;
203203

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

0 commit comments

Comments
 (0)