scalar reconfigure: add --maintenance=<mode> option

When users want to enable the latest and greatest configuration options
recommended by Scalar after a Git upgrade, 'scalar reconfigure --all' is
a great option that iterates over all repos in the multi-valued
'scalar.repos' config key.

However, this feature previously forced users to enable background
maintenance. In some environments this is not preferred.

Add a new --maintenance=<mode> option to 'scalar reconfigure' that
provides options for enabling (default), disabling, or leaving
background maintenance config as-is.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Derrick Stolee
2025-05-07 01:50:37 +00:00
committed by Junio C Hamano
parent 882ce0c475
commit a34fef86e0
3 changed files with 47 additions and 6 deletions

View File

@@ -210,7 +210,18 @@ test_expect_success 'scalar reconfigure' '
GIT_TRACE2_EVENT="$(pwd)/reconfigure" scalar reconfigure -a &&
test_path_is_file one/src/cron.txt &&
test true = "$(git -C one/src config core.preloadIndex)" &&
test_subcommand git maintenance start <reconfigure
test_subcommand git maintenance start <reconfigure &&
test_subcommand ! git maintenance unregister --force <reconfigure &&
GIT_TRACE2_EVENT="$(pwd)/reconfigure-maint-disable" \
scalar reconfigure -a --maintenance=disable &&
test_subcommand ! git maintenance start <reconfigure-maint-disable &&
test_subcommand git maintenance unregister --force <reconfigure-maint-disable &&
GIT_TRACE2_EVENT="$(pwd)/reconfigure-maint-keep" \
scalar reconfigure --maintenance=keep -a &&
test_subcommand ! git maintenance start <reconfigure-maint-keep &&
test_subcommand ! git maintenance unregister --force <reconfigure-maint-keep
'
test_expect_success 'scalar reconfigure --all with includeIf.onbranch' '