| 736 | } |
| 737 | |
| 738 | void 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 | |
| 778 | int validate_trailer_args(const struct strvec *cli_args) |
| 779 | { |
no test coverage detected