| 2628 | } |
| 2629 | |
| 2630 | static int check_label_or_ref_arg(enum todo_command command, const char *arg) |
| 2631 | { |
| 2632 | switch (command) { |
| 2633 | case TODO_LABEL: |
| 2634 | /* |
| 2635 | * '#' is not a valid label as the merge command uses it to |
| 2636 | * separate merge parents from the commit subject. |
| 2637 | */ |
| 2638 | if (!strcmp(arg, "#") || |
| 2639 | check_refname_format(arg, REFNAME_ALLOW_ONELEVEL)) |
| 2640 | return error(_("'%s' is not a valid label"), arg); |
| 2641 | break; |
| 2642 | |
| 2643 | case TODO_UPDATE_REF: |
| 2644 | if (check_refname_format(arg, REFNAME_ALLOW_ONELEVEL)) |
| 2645 | return error(_("'%s' is not a valid refname"), arg); |
| 2646 | if (check_refname_format(arg, 0)) |
| 2647 | return error(_("update-ref requires a fully qualified " |
| 2648 | "refname e.g. refs/heads/%s"), arg); |
| 2649 | break; |
| 2650 | |
| 2651 | default: |
| 2652 | BUG("unexpected todo_command"); |
| 2653 | } |
| 2654 | |
| 2655 | return 0; |
| 2656 | } |
| 2657 | |
| 2658 | static int check_merge_commit_insn(enum todo_command command) |
| 2659 | { |
no test coverage detected