MCPcopy Create free account
hub / github.com/git/git / is_main_worktree_path

Function is_main_worktree_path

worktree.c:763–778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761}
762
763static int is_main_worktree_path(const char *path)
764{
765 struct strbuf target = STRBUF_INIT;
766 struct strbuf maindir = STRBUF_INIT;
767 int cmp;
768
769 strbuf_add_real_path(&target, path);
770 strbuf_strip_suffix(&target, "/.git");
771 strbuf_add_real_path(&maindir, repo_get_common_dir(the_repository));
772 strbuf_strip_suffix(&maindir, "/.git");
773 cmp = fspathcmp(maindir.buf, target.buf);
774
775 strbuf_release(&maindir);
776 strbuf_release(&target);
777 return !cmp;
778}
779
780/*
781 * If both the main worktree and linked worktree have been moved, then the

Callers 1

repair_worktree_at_pathFunction · 0.85

Calls 4

strbuf_add_real_pathFunction · 0.85
strbuf_strip_suffixFunction · 0.85
repo_get_common_dirFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected