Skip to content

Commit

Permalink
Merge branch 'scalar-reconfigure'
Browse files Browse the repository at this point in the history
This allows fixing settings after a Scalar upgrade, or after botching
the enlistments configuration.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Jun 17, 2022
2 parents d2b0446 + bcb02d3 commit bb889a2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,23 @@ static int set_recommended_config(int reconfigure)
int i;
char *value;

/*
* If a user has "core.usebuiltinfsmonitor" enabled, try to switch to
* the new (non-deprecated) setting (core.fsmonitor).
*/
if (!git_config_get_string("core.usebuiltinfsmonitor", &value)) {
char *dummy = NULL;
if (git_config_get_string("core.fsmonitor", &dummy) &&
git_config_set_gently("core.fsmonitor", value) < 0)
return error(_("could not configure %s=%s"),
"core.fsmonitor", value);
if (git_config_set_gently("core.usebuiltinfsmonitor", NULL) < 0)
return error(_("could not configure %s=%s"),
"core.useBuiltinFSMonitor", "NULL");
free(value);
free(dummy);
}

for (i = 0; config[i].key; i++) {
if ((reconfigure && config[i].overwrite_on_reconfigure) ||
git_config_get_string(config[i].key, &value)) {
Expand Down

0 comments on commit bb889a2

Please sign in to comment.