summaryrefslogtreecommitdiffstats
path: root/worktree.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-08-13 11:13:37 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-13 19:01:01 +0200
commita973f60dc7c178828e351ec4e68886ffecfbcadc (patch)
tree1dc78a861d10f3df03ffee3ea0210be5985fd36d /worktree.c
parentpath: stop relying on `the_repository` when reporting garbage (diff)
downloadgit-a973f60dc7c178828e351ec4e68886ffecfbcadc.tar.xz
git-a973f60dc7c178828e351ec4e68886ffecfbcadc.zip
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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'worktree.c')
-rw-r--r--worktree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/worktree.c b/worktree.c
index f3c4c8ec54..886c5db691 100644
--- a/worktree.c
+++ b/worktree.c
@@ -252,7 +252,7 @@ const char *worktree_lock_reason(struct worktree *wt)
if (!wt->lock_reason_valid) {
struct strbuf path = STRBUF_INIT;
- strbuf_addstr(&path, worktree_git_path(wt, "locked"));
+ strbuf_addstr(&path, worktree_git_path(the_repository, wt, "locked"));
if (file_exists(path.buf)) {
struct strbuf lock_reason = STRBUF_INIT;
if (strbuf_read_file(&lock_reason, path.buf, 0) < 0)