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

Function parse_worktree_ref

refs.c:945–991  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

943}
944
945enum ref_worktree_type parse_worktree_ref(const char *maybe_worktree_ref,
946 const char **worktree_name, int *worktree_name_length,
947 const char **bare_refname)
948{
949 const char *name_dummy;
950 int name_length_dummy;
951 const char *ref_dummy;
952
953 if (!worktree_name)
954 worktree_name = &name_dummy;
955 if (!worktree_name_length)
956 worktree_name_length = &name_length_dummy;
957 if (!bare_refname)
958 bare_refname = &ref_dummy;
959
960 if (skip_prefix(maybe_worktree_ref, "worktrees/", bare_refname)) {
961 const char *slash = strchr(*bare_refname, '/');
962
963 *worktree_name = *bare_refname;
964 if (!slash) {
965 *worktree_name_length = strlen(*worktree_name);
966
967 /* This is an error condition, and the caller tell because the bare_refname is "" */
968 *bare_refname = *worktree_name + *worktree_name_length;
969 return REF_WORKTREE_OTHER;
970 }
971
972 *worktree_name_length = slash - *bare_refname;
973 *bare_refname = slash + 1;
974
975 if (is_current_worktree_ref(*bare_refname))
976 return REF_WORKTREE_OTHER;
977 }
978
979 *worktree_name = NULL;
980 *worktree_name_length = 0;
981
982 if (skip_prefix(maybe_worktree_ref, "main-worktree/", bare_refname)
983 && is_current_worktree_ref(*bare_refname))
984 return REF_WORKTREE_MAIN;
985
986 *bare_refname = maybe_worktree_ref;
987 if (is_current_worktree_ref(maybe_worktree_ref))
988 return REF_WORKTREE_CURRENT;
989
990 return REF_WORKTREE_SHARED;
991}
992
993long get_files_ref_lock_timeout_ms(struct repository *repo)
994{

Callers 11

is_headFunction · 0.85
strbuf_worktree_refFunction · 0.85
refs_fsck_symrefFunction · 0.85
ref_iterator_selectFunction · 0.85
backend_forFunction · 0.85
files_reflog_pathFunction · 0.85
files_ref_pathFunction · 0.85
should_pack_refFunction · 0.85
collect_reflogFunction · 0.85

Calls 1

is_current_worktree_refFunction · 0.85

Tested by

no test coverage detected