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

Function check_branch_ref

refs.c:762–782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

760}
761
762int check_branch_ref(struct strbuf *sb, const char *name)
763{
764 if (startup_info->have_repository)
765 copy_branchname(sb, name, INTERPRET_BRANCH_LOCAL);
766 else
767 strbuf_addstr(sb, name);
768
769 /*
770 * This splice must be done even if we end up rejecting the
771 * name; builtin/branch.c::copy_or_rename_branch() still wants
772 * to see what the name expanded to so that "branch -m" can be
773 * used as a tool to correct earlier mistakes.
774 */
775 strbuf_splice(sb, 0, 0, "refs/heads/", 11);
776
777 if (*name == '-' ||
778 !strcmp(sb->buf, "refs/heads/HEAD"))
779 return -1;
780
781 return check_refname_format(sb->buf, 0);
782}
783
784int check_tag_ref(struct strbuf *sb, const char *name)
785{

Callers 7

validate_branchnameFunction · 0.85
add_worktreeFunction · 0.85
dwim_branchFunction · 0.85
addFunction · 0.85
copy_or_rename_branchFunction · 0.85
check_ref_format_branchFunction · 0.85

Calls 4

copy_branchnameFunction · 0.85
strbuf_addstrFunction · 0.85
strbuf_spliceFunction · 0.85
check_refname_formatFunction · 0.85

Tested by

no test coverage detected