MCPcopy Index your code
hub / github.com/git/git / find_worktree_by_path

Function find_worktree_by_path

worktree.c:279–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279struct 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
298int is_main_worktree(const struct worktree *wt)
299{

Callers 2

find_worktreeFunction · 0.85
check_candidate_pathFunction · 0.85

Calls 3

real_pathdupFunction · 0.85
strbuf_realpathFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected