path: refactor repo_git_path() family of functions

As explained in an earlier commit, we're refactoring path-related
functions to provide a consistent interface for computing paths into the
commondir, gitdir and worktree. Refactor the "gitdir" family of
functions accordingly.

Note that the `repo_git_pathv()` function is converted into an internal
implementation detail. It is only used to implement `the_repository`
compatibility shims and will eventually be removed from the public
interface.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2025-02-07 12:03:27 +01:00
committed by Junio C Hamano
parent 70a16ff8a1
commit bdfc07bfdf
5 changed files with 32 additions and 32 deletions

3
hook.c
View File

@ -16,8 +16,7 @@ const char *find_hook(struct repository *r, const char *name)
int found_hook;
strbuf_reset(&path);
strbuf_repo_git_path(&path, r, "hooks/%s", name);
repo_git_path_replace(r, &path, "hooks/%s", name);
found_hook = access(path.buf, X_OK) >= 0;
#ifdef STRIP_EXTENSION
if (!found_hook) {