From: Junio C Hamano Date: Wed, 26 Mar 2025 07:26:09 +0000 (+0900) Subject: Merge branch 'sj/ref-consistency-checks-more' X-Git-Tag: v2.50.0-rc0~176 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=de35b7b3ffb6e642b47f748eb38e31182377fb0a;p=thirdparty%2Fgit.git Merge branch 'sj/ref-consistency-checks-more' "git fsck" becomes more careful when checking the refs. * sj/ref-consistency-checks-more: builtin/fsck: add `git refs verify` child process packed-backend: check whether the "packed-refs" is sorted packed-backend: add "packed-refs" entry consistency check packed-backend: check whether the refname contains NUL characters packed-backend: add "packed-refs" header consistency check packed-backend: check if header starts with "# pack-refs with: " packed-backend: check whether the "packed-refs" is regular file builtin/refs: get worktrees without reading head information t0602: use subshell to ensure working directory unchanged --- de35b7b3ffb6e642b47f748eb38e31182377fb0a diff --cc worktree.c index 6449b6798d,89b7d86cef..c34b9eb74e --- a/worktree.c +++ b/worktree.c @@@ -199,14 -175,19 +199,19 @@@ struct worktree **get_worktrees(void return get_worktrees_internal(0); } + struct worktree **get_worktrees_without_reading_head(void) + { + return get_worktrees_internal(1); + } + -const char *get_worktree_git_dir(const struct worktree *wt) +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,