From a973f60dc7c178828e351ec4e68886ffecfbcadc Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 13 Aug 2024 11:13:37 +0200 Subject: path: stop relying on `the_repository` in `worktree_git_path()` When not provided a worktree, then `worktree_git_path()` will fall back to returning a path relative to the main repository. In this case, we implicitly rely on `the_repository` to derive the path. Remove this dependency by passing a `struct repository` as parameter. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- path.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'path.h') diff --git a/path.h b/path.h index 9a4a4a8fb3..78e9230de9 100644 --- a/path.h +++ b/path.h @@ -95,11 +95,13 @@ const char *git_path(const char *fmt, ...) /* * Similar to git_path() but can produce paths for a specified - * worktree instead of current one + * worktree instead of current one. When no worktree is given, then the path is + * computed relative to main worktree of the given repository. */ -const char *worktree_git_path(const struct worktree *wt, +const char *worktree_git_path(struct repository *r, + const struct worktree *wt, const char *fmt, ...) - __attribute__((format (printf, 2, 3))); + __attribute__((format (printf, 3, 4))); /* * Return a path into the main repository's (the_repository) git directory. -- cgit v1.3