Skip to content

Commit e74dc57

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 0ca5b50 commit e74dc57

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

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

0 commit comments

Comments
 (0)