Skip to content

Commit dea6308

Browse files
derrickstoleegitster
authored andcommitted
scalar: only warn when background maintenance fails
A user reported issues with 'scalar clone' and 'scalar register' when working in an environment that had locked down the ability to run 'crontab' or 'systemctl' in that those commands registered as _failures_ instead of opportunistically reporting a success with just a warning about background maintenance. As a workaround, they can use GIT_TEST_MAINT_SCHEDULER to fake a successful background maintenance, but this is not a viable strategy for long-term. Update 'scalar register' and 'scalar clone' to no longer fail by modifying register_dir() to only warn when toggle_maintenance(1) fails. Since background maintenance is a "nice to have" and not a requirement for a working repository, it is best to move this from hard error to gentle warning. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent eeea9ae commit dea6308

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

scalar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static int register_dir(void)
262262
return error(_("could not set recommended config"));
263263

264264
if (toggle_maintenance(1))
265-
return error(_("could not turn on maintenance"));
265+
warning(_("could not turn on maintenance"));
266266

267267
if (have_fsmonitor_support() && start_fsmonitor_daemon()) {
268268
return error(_("could not start the FSMonitor daemon"));

t/t9210-scalar.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ test_expect_success FSMONITOR_DAEMON 'scalar register starts fsmon daemon' '
104104
test_cmp_config -C test/src true core.fsmonitor
105105
'
106106

107-
test_expect_success 'scalar register fails when background maintenance fails' '
107+
test_expect_success 'scalar register warns when background maintenance fails' '
108108
git init register-repo &&
109109
GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \
110-
test_must_fail scalar register register-repo 2>err &&
110+
scalar register register-repo 2>err &&
111111
grep "could not turn on maintenance" err
112112
'
113113

t/t9211-scalar-clone.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ test_expect_success 'progress without tty' '
174174
cleanup_clone $enlistment
175175
'
176176

177-
test_expect_success 'scalar clone fails when background maintenance fails' '
177+
test_expect_success 'scalar clone warns when background maintenance fails' '
178178
GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \
179-
test_must_fail scalar clone "file://$(pwd)/to-clone" maint-fail 2>err &&
179+
scalar clone "file://$(pwd)/to-clone" maint-fail 2>err &&
180180
grep "could not turn on maintenance" err
181181
'
182182

0 commit comments

Comments
 (0)