From f5c714e2a7d6239548b94c37ae906484e94b5bc7 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 7 Feb 2025 12:03:30 +0100 Subject: path: refactor `repo_submodule_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 "submodule" family of functions accordingly. Note that in contrast to the other `repo_*_path()` families, we have to pass in the repository as a non-constant pointer. This is because we end up calling `repo_read_gitmodules()` deep down in the callstack, which may end up modifying the repository. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- worktree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'worktree.c') diff --git a/worktree.c b/worktree.c index f8d6e7127f..8f4fc10c44 100644 --- a/worktree.c +++ b/worktree.c @@ -487,7 +487,8 @@ int submodule_uses_worktrees(const char *path) int ret = 0; struct repository_format format = REPOSITORY_FORMAT_INIT; - submodule_gitdir = git_pathdup_submodule(path, "%s", ""); + submodule_gitdir = repo_submodule_path(the_repository, + path, "%s", ""); if (!submodule_gitdir) return 0; -- cgit v1.2.3