]> git.ipfire.org Git - thirdparty/git.git/commit
path: hide functions using `the_repository` by default
authorPatrick Steinhardt <ps@pks.im>
Tue, 13 Aug 2024 09:13:40 +0000 (11:13 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Aug 2024 17:01:01 +0000 (10:01 -0700)
commit7ac16649eca0ee206fdb203a76fa4330484b3b6a
treedf7b9143ab79c5832a49ad51ea7ab3133192492d
parenta973f60dc7c178828e351ec4e68886ffecfbcadc
path: hide functions using `the_repository` by default

The path subsystem provides a bunch of legacy functions that compute
paths relative to the "gitdir" and "commondir" directories of the global
`the_repository` variable. Use of those functions is discouraged, and it
is easy to miss the implicit dependency on `the_repository` that calls
to those functions may cause.

With `USE_THE_REPOSITORY_VARIABLE`, we have recently introduced a tool
that allows us to get rid of such functions over time. With this macro,
we can hide away functions that have such implicit dependency such that
other subsystems that want to be free of `the_repository` will not use
them by accident.

Move all path-related functions that use `the_repository` into a block
that gets only conditionally compiled depending on whether or not the
macro has been defined. This also removes all dependencies on that
variable in "path.c", allowing us to remove the definition of said
preprocessor macro.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
path.c
path.h