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

Function check_label_or_ref_arg

sequencer.c:2630–2656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2628}
2629
2630static 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
2658static int check_merge_commit_insn(enum todo_command command)
2659{

Callers 1

parse_insn_lineFunction · 0.85

Calls 2

check_refname_formatFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected