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:
authorEric Sunshine <sunshine@sunshineco.com>2021-02-23 10:31:07 +0300
committerJunio C Hamano <gitster@pobox.com>2021-02-23 11:22:45 +0300
commit26c7974376fad730ba5bc1926afe7d26ba8d91e0 (patch)
tree554605ecaad0b8f6ec3fb83ee8ddef778dea506f /t/t7900-maintenance.sh
parent966e671106b2fd38301e7c344c754fd118d0bb07 (diff)
maintenance: fix incorrect `maintenance.repo` path with bare repository
The periodic maintenance tasks configured by `git maintenance start` invoke `git for-each-repo` to run `git maintenance run` on each path specified by the multi-value global configuration variable `maintenance.repo`. Because `git for-each-repo` will likely be run outside of the repositories which require periodic maintenance, it is mandatory that the repository paths specified by `maintenance.repo` are absolute. Unfortunately, however, `git maintenance register` does nothing to ensure that the paths it assigns to `maintenance.repo` are indeed absolute, and may in fact -- especially in the case of a bare repository -- assign a relative path to `maintenance.repo` instead. Fix this problem by converting all paths to absolute before assigning them to `maintenance.repo`. While at it, also fix `git maintenance unregister` to convert paths to absolute, as well, in order to ensure that it can correctly remove from `maintenance.repo` a path assigned via `git maintenance register`. Reported-by: Clement Moyroud <clement.moyroud@gmail.com> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7900-maintenance.sh')
-rwxr-xr-xt/t7900-maintenance.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
index 286b18db3c..2412d8c5c0 100755
--- a/t/t7900-maintenance.sh
+++ b/t/t7900-maintenance.sh
@@ -632,4 +632,17 @@ test_expect_success 'fails when running outside of a repository' '
nongit test_must_fail git maintenance unregister
'
+test_expect_success 'register and unregister bare repo' '
+ test_when_finished "git config --global --unset-all maintenance.repo || :" &&
+ test_might_fail git config --global --unset-all maintenance.repo &&
+ git init --bare barerepo &&
+ (
+ cd barerepo &&
+ git maintenance register &&
+ git config --get --global --fixed-value maintenance.repo "$(pwd)" &&
+ git maintenance unregister &&
+ test_must_fail git config --global --get-all maintenance.repo
+ )
+'
+
test_done