]> git.ipfire.org Git - thirdparty/git.git/commit
maintenance: fix incorrect `maintenance.repo` path with bare repository
authorEric Sunshine <sunshine@sunshineco.com>
Tue, 23 Feb 2021 07:31:07 +0000 (02:31 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 23 Feb 2021 08:22:45 +0000 (00:22 -0800)
commit26c7974376fad730ba5bc1926afe7d26ba8d91e0
tree554605ecaad0b8f6ec3fb83ee8ddef778dea506f
parent966e671106b2fd38301e7c344c754fd118d0bb07
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>
builtin/gc.c
t/t7900-maintenance.sh