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

Function parse_trailers_from_command_line_args

trailer.c:738–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

736}
737
738void parse_trailers_from_command_line_args(struct list_head *arg_head,
739 struct list_head *new_trailer_head)
740{
741 struct strbuf tok = STRBUF_INIT;
742 struct strbuf val = STRBUF_INIT;
743 const struct conf_info *conf;
744 struct list_head *pos;
745
746 /*
747 * In command-line arguments, '=' is accepted (in addition to the
748 * separators that are defined).
749 */
750 char *cl_separators = xstrfmt("=%s", separators);
751
752 /* Add an arg item for each trailer on the command line */
753 list_for_each(pos, new_trailer_head) {
754 struct new_trailer_item *tr =
755 list_entry(pos, struct new_trailer_item, list);
756 ssize_t separator_pos = find_separator(tr->text, cl_separators);
757
758 if (separator_pos == 0) {
759 struct strbuf sb = STRBUF_INIT;
760 strbuf_addstr(&sb, tr->text);
761 strbuf_trim(&sb);
762 error(_("empty trailer token in trailer '%.*s'"),
763 (int) sb.len, sb.buf);
764 strbuf_release(&sb);
765 } else {
766 parse_trailer(&tok, &val, &conf, tr->text,
767 separator_pos);
768 add_arg_item(arg_head,
769 strbuf_detach(&tok, NULL),
770 strbuf_detach(&val, NULL),
771 conf, tr);
772 }
773 }
774
775 free(cl_separators);
776}
777
778int validate_trailer_args(const struct strvec *cli_args)
779{

Callers 1

process_trailersFunction · 0.85

Calls 9

xstrfmtFunction · 0.85
find_separatorFunction · 0.85
strbuf_addstrFunction · 0.85
strbuf_trimFunction · 0.85
errorFunction · 0.85
strbuf_releaseFunction · 0.85
parse_trailerFunction · 0.85
add_arg_itemFunction · 0.85
strbuf_detachFunction · 0.85

Tested by

no test coverage detected