]> git.ipfire.org Git - thirdparty/git.git/commit
maintenance: update schedule before config
authorDerrick Stolee <derrickstolee@github.com>
Thu, 10 Aug 2023 20:39:47 +0000 (20:39 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 10 Aug 2023 21:04:17 +0000 (14:04 -0700)
commit69ecfcacfd136810f2343b548174efe9ae3fdead
treeac07627110e9cc44534d00729d4d5d3ca45a5521
parentc97ec0378b97036c62492678931a297a4498d12c
maintenance: update schedule before config

When running 'git maintenance start', the current pattern is to
configure global config settings to enable maintenance on the current
repository and set 'maintenance.auto' to false and _then_ to set up the
schedule with the system scheduler.

This has a problematic error condition: if the scheduler fails to
initialize, the repository still will not use automatic maintenance due
to the 'maintenance.auto' setting.

Fix this gap by swapping the order of operations. If Git fails to
initialize maintenance, then the config changes should never happen.

Reported-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/gc.c
t/t7900-maintenance.sh