Commit ff5a3ea
worktree: remove "the_repository" from is_current_worktree()
is_current_worktree() compares the gitdir of the worktree to the gitdir
of "the_repository" and returns true when they match. To get the gitdir
of the worktree it calls get_workree_git_dir() which also depends on
"the_repository". This has the effect that even if "wt->path" matches
"wt->repo->worktree" is_current_worktree(wt) will return false when
"wt->repo" is not "the_repository" which is confusing.
The use of "the_repository" in is_current_wortree() comes from
replacing get_git_dir() with repo_get_git_dir() in 246deea
(environment: make `get_git_dir()` accept a repository, 2024-09-12). In
get_worktree_git_dir() it comes from replacing git_common_path() with
repo_common_path() in 07242c2 (path: drop `git_common_path()`
in favor of `repo_common_path()`, 2025-02-07). In both cases we have
a repository instance available so use that instead. This means
that a worktree "wt" is always considered current when "wt->path"
matches "wt->repo->worktree" and so the worktree returned by
get_worktree_from_repository() is always considered current.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 7f19e4e commit ff5a3ea
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| |||
0 commit comments