Skip to content

Commit fc66968

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 d28db13 commit fc66968

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
@@ -213,6 +213,23 @@ static int set_recommended_config(int reconfigure)
213213
int i;
214214
char *value;
215215

216+
/*
217+
* If a user has "core.usebuiltinfsmonitor" enabled, try to switch to
218+
* the new (non-deprecated) setting (core.fsmonitor).
219+
*/
220+
if (!repo_config_get_string(the_repository, "core.usebuiltinfsmonitor", &value)) {
221+
char *dummy = NULL;
222+
if (repo_config_get_string(the_repository, "core.fsmonitor", &dummy) &&
223+
repo_config_set_gently(the_repository, "core.fsmonitor", value) < 0)
224+
return error(_("could not configure %s=%s"),
225+
"core.fsmonitor", value);
226+
if (repo_config_set_gently(the_repository, "core.usebuiltinfsmonitor", NULL) < 0)
227+
return error(_("could not configure %s=%s"),
228+
"core.useBuiltinFSMonitor", "NULL");
229+
free(value);
230+
free(dummy);
231+
}
232+
216233
for (i = 0; config[i].key; i++) {
217234
if (set_config_if_missing(config + i, reconfigure))
218235
return error(_("could not configure %s=%s"),

0 commit comments

Comments
 (0)