return get_worktrees_internal(0);
}
-const char *get_worktree_git_dir(const struct worktree *wt)
+ struct worktree **get_worktrees_without_reading_head(void)
+ {
+ return get_worktrees_internal(1);
+ }
+
+char *get_worktree_git_dir(const struct worktree *wt)
{
if (!wt)
- return repo_get_git_dir(the_repository);
+ return xstrdup(repo_get_git_dir(the_repository));
else if (!wt->id)
- return repo_get_common_dir(the_repository);
+ return xstrdup(repo_get_common_dir(the_repository));
else
- return git_common_path("worktrees/%s", wt->id);
+ return repo_common_path(the_repository, "worktrees/%s", wt->id);
}
static struct worktree *find_worktree_by_suffix(struct worktree **list,