summaryrefslogtreecommitdiff
path: root/worktree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-06-13 20:19:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-06-13 20:19:41 (GMT)
commit000bce0ee4d0ef719b84fb643c45fe68fa4bb773 (patch)
tree10840f2b1f53f5549db2eafb4493443fcefe3303 /worktree.c
parented7f8acbaa3d986a8b4e8d625b2f54355ce15ef0 (diff)
parent105df73e71a9eb901d7ca96f12ce3645729ae486 (diff)
downloadgit-000bce0ee4d0ef719b84fb643c45fe68fa4bb773.zip
git-000bce0ee4d0ef719b84fb643c45fe68fa4bb773.tar.gz
git-000bce0ee4d0ef719b84fb643c45fe68fa4bb773.tar.bz2
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.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/worktree.c b/worktree.c
index 4f66cd9..5b4793c 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;