Merge branch 'js/for-each-repo-keep-going'

A scheduled "git maintenance" job is expected to work on all
repositories it knows about, but it stopped at the first one that
errored out.  Now it keeps going.

* js/for-each-repo-keep-going:
  maintenance: running maintenance should not stop on errors
  for-each-repo: optionally keep going on an error
This commit is contained in:
Junio C Hamano
2024-04-30 14:49:45 -07:00
5 changed files with 43 additions and 8 deletions

View File

@ -59,4 +59,20 @@ test_expect_success 'error on NULL value for config keys' '
test_cmp expect actual
'
test_expect_success '--keep-going' '
git config keep.going non-existing &&
git config --add keep.going . &&
test_must_fail git for-each-repo --config=keep.going \
-- branch >out 2>err &&
test_grep "cannot change to .*non-existing" err &&
test_must_be_empty out &&
test_must_fail git for-each-repo --config=keep.going --keep-going \
-- branch >out 2>err &&
test_grep "cannot change to .*non-existing" err &&
git branch >expect &&
test_cmp expect out
'
test_done

View File

@ -639,9 +639,9 @@ test_expect_success 'start from empty cron table' '
# start registers the repo
git config --get --global --fixed-value maintenance.repo "$(pwd)" &&
grep "for-each-repo --config=maintenance.repo maintenance run --schedule=daily" cron.txt &&
grep "for-each-repo --config=maintenance.repo maintenance run --schedule=hourly" cron.txt &&
grep "for-each-repo --config=maintenance.repo maintenance run --schedule=weekly" cron.txt
grep "for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=daily" cron.txt &&
grep "for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=hourly" cron.txt &&
grep "for-each-repo --keep-going --config=maintenance.repo maintenance run --schedule=weekly" cron.txt
'
test_expect_success 'stop from existing schedule' '