| 277 | } |
| 278 | |
| 279 | struct worktree *find_worktree_by_path(struct worktree **list, const char *p) |
| 280 | { |
| 281 | struct strbuf wt_path = STRBUF_INIT; |
| 282 | char *path = real_pathdup(p, 0); |
| 283 | |
| 284 | if (!path) |
| 285 | return NULL; |
| 286 | for (; *list; list++) { |
| 287 | if (!strbuf_realpath(&wt_path, (*list)->path, 0)) |
| 288 | continue; |
| 289 | |
| 290 | if (!fspathcmp(path, wt_path.buf)) |
| 291 | break; |
| 292 | } |
| 293 | free(path); |
| 294 | strbuf_release(&wt_path); |
| 295 | return *list; |
| 296 | } |
| 297 | |
| 298 | int is_main_worktree(const struct worktree *wt) |
| 299 | { |
no test coverage detected