diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-06-13 23:19:41 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-06-13 23:19:41 +0300 |
commit | 000bce0ee4d0ef719b84fb643c45fe68fa4bb773 (patch) | |
tree | 10840f2b1f53f5549db2eafb4493443fcefe3303 /worktree.c | |
parent | ed7f8acbaa3d986a8b4e8d625b2f54355ce15ef0 (diff) | |
parent | 105df73e71a9eb901d7ca96f12ce3645729ae486 (diff) |
Merge branch 'nd/corrupt-worktrees'
"git worktree add" used to fail when another worktree connected to
the same repository was corrupt, which has been corrected.
* nd/corrupt-worktrees:
worktree add: be tolerant of corrupt worktrees
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; |