| 760 | } |
| 761 | |
| 762 | int 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 | |
| 784 | int check_tag_ref(struct strbuf *sb, const char *name) |
| 785 | { |
no test coverage detected