Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2022-09-27 16:56:59 +0300
committerJunio C Hamano <gitster@pobox.com>2022-09-27 19:32:26 +0300
commitd871b6c6c634689134a92d068bfb066d77d8429d (patch)
tree72114758a276c62065dcab06a2eb4f1afa902949 /scalar.c
parent1ebe6b029703e4bebf413ec052918a81390797ac (diff)
scalar: make 'unregister' idempotent
The 'scalar unregister' command removes a repository from the list of registered Scalar repositories and removes it from the list of repositories registered for background maintenance. If the repository was not already registered for background maintenance, then the command fails, even if the repository was still registered as a Scalar repository. After using 'scalar clone' or 'scalar register', the repository would be enrolled in background maintenance since those commands run 'git maintenance start'. If the user runs 'git maintenance unregister' on that repository, then it is still in the list of repositories which get new config updates from 'scalar reconfigure'. The 'scalar unregister' command would fail since 'git maintenance unregister' would fail. Further, the add_or_remove_enlistment() method in scalar.c already has this idempotent nature built in as an expectation since it returns zero when the scalar.repo list already has the proper containment of the repository. The previous change added the 'git maintenance unregister --force' option, so use it within 'scalar unregister' to make it idempotent. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'scalar.c')
-rw-r--r--scalar.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/scalar.c b/scalar.c
index c5c1ce6891..6de9c0ee52 100644
--- a/scalar.c
+++ b/scalar.c
@@ -207,7 +207,10 @@ static int set_recommended_config(int reconfigure)
static int toggle_maintenance(int enable)
{
- return run_git("maintenance", enable ? "start" : "unregister", NULL);
+ return run_git("maintenance",
+ enable ? "start" : "unregister",
+ enable ? NULL : "--force",
+ NULL);
}
static int add_or_remove_enlistment(int add)