]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/gc.c
maintenance: skip bootout/bootstrap when plist is registered
authorDerrick Stolee <dstolee@microsoft.com>
Tue, 24 Aug 2021 15:44:00 +0000 (15:44 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 Aug 2021 21:16:58 +0000 (14:16 -0700)
commita16eb6b1ff333f3e26b99f17ef3bb7dbf8135f39
tree73cdc9fb261381f02e7d3db79bcebc6ee5358117
parentbb01122a82002dc5948147800da40a149779a7b1
maintenance: skip bootout/bootstrap when plist is registered

On macOS, we use launchctl to manage the background maintenance
schedule. This uses a set of .plist files to describe the schedule, but
these files are also registered with 'launchctl bootstrap'. If multiple
'git maintenance start' commands run concurrently, then they can collide
replacing these schedule files and registering them with launchctl.

To avoid extra launchctl commands, do a check for the .plist files on
disk and check if they are registered using 'launchctl list <name>'.
This command will return with exit code 0 if it exists, or exit code 113
if it does not.

We can test this behavior using the GIT_TEST_MAINT_SCHEDULER environment
variable.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/gc.c
t/t7900-maintenance.sh