]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/gc.c
maintenance: add 'unregister --force'
authorDerrick Stolee <derrickstolee@github.com>
Tue, 27 Sep 2022 13:56:58 +0000 (13:56 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 Sep 2022 16:32:25 +0000 (09:32 -0700)
commit1ebe6b029703e4bebf413ec052918a81390797ac
tree0c495d84efc920b4aff285f27e852c005e9d195c
parent1b3d6e17fe83eb6f79ffbac2f2c61bbf1eaef5f8
maintenance: add 'unregister --force'

The 'git maintenance unregister' subcommand has a step that removes the
current repository from the multi-valued maitenance.repo config key.
This fails if the repository is not listed in that key. This makes
running 'git maintenance unregister' twice result in a failure in the
second instance.

This failure exit code is helpful, but its message is not. Add a new
die() message that explicitly calls out the failure due to the
repository not being registered.

In some cases, users may want to run 'git maintenance unregister' just
to make sure that background jobs will not start on this repository, but
they do not want to check to see if it is registered first. Add a new
'--force' option that will siltently succeed if the repository is not
already registered.

Also add an extra test of 'git maintenance unregister' at a point where
there are no registered repositories. This should fail without --force.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-maintenance.txt
builtin/gc.c
t/t7900-maintenance.sh