diff options
Diffstat (limited to 'worktree.c')
-rw-r--r-- | worktree.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/worktree.c b/worktree.c index 4f66cd9ce1..5b4793caa3 100644 --- a/worktree.c +++ b/worktree.c @@ -228,9 +228,12 @@ struct worktree *find_worktree(struct worktree **list, free(to_free); return NULL; } - for (; *list; list++) - if (!fspathcmp(path, real_path((*list)->path))) + for (; *list; list++) { + const char *wt_path = real_path_if_valid((*list)->path); + + if (wt_path && !fspathcmp(path, wt_path)) break; + } free(path); free(to_free); return *list; |