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>
This commit is contained in:

committed by
Junio C Hamano

parent
78f2210b3c
commit
a973f60dc7
@ -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)
|
||||
|
Reference in New Issue
Block a user