X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=parse-options.c;h=879ea82a3158ca5e6d4ca397e0c2dd2265e15edc;hb=d190a0875ff0f33d60a4d7265f2098b35d162f68;hp=73bd28ad90986af1618d82176076133186d045de;hpb=055f2c5d340508d3542ede8dc1db2aedd0b9f1b5;p=git.git diff --git a/parse-options.c b/parse-options.c index 73bd28ad9..879ea82a3 100644 --- a/parse-options.c +++ b/parse-options.c @@ -3,6 +3,7 @@ #include "cache.h" #include "commit.h" #include "color.h" +#include "string-list.h" static int parse_options_usage(struct parse_opt_ctx_t *ctx, const char * const *usagestr, @@ -687,3 +688,19 @@ int parse_options_concat(struct option *dst, size_t dst_size, struct option *src } return -1; } + +int parse_opt_string_list(const struct option *opt, const char *arg, int unset) +{ + struct string_list *v = opt->value; + + if (unset) { + string_list_clear(v, 0); + return 0; + } + + if (!arg) + return -1; + + string_list_append(v, xstrdup(arg)); + return 0; +}