remote: use new OPT_STRING_LIST
This saves us having our own callback function. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
c8ba163916
commit
615ff912c5
|
@ -88,16 +88,6 @@ static inline int postfixcmp(const char *string, const char *postfix)
|
||||||
return strcmp(string + len1 - len2, postfix);
|
return strcmp(string + len1 - len2, postfix);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int opt_parse_track(const struct option *opt, const char *arg, int not)
|
|
||||||
{
|
|
||||||
struct string_list *list = opt->value;
|
|
||||||
if (not)
|
|
||||||
string_list_clear(list, 0);
|
|
||||||
else
|
|
||||||
string_list_append(list, arg);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int fetch_remote(const char *name)
|
static int fetch_remote(const char *name)
|
||||||
{
|
{
|
||||||
const char *argv[] = { "fetch", name, NULL, NULL };
|
const char *argv[] = { "fetch", name, NULL, NULL };
|
||||||
|
@ -176,8 +166,8 @@ static int add(int argc, const char **argv)
|
||||||
TAGS_SET),
|
TAGS_SET),
|
||||||
OPT_SET_INT(0, NULL, &fetch_tags,
|
OPT_SET_INT(0, NULL, &fetch_tags,
|
||||||
"or do not fetch any tag at all (--no-tags)", TAGS_UNSET),
|
"or do not fetch any tag at all (--no-tags)", TAGS_UNSET),
|
||||||
OPT_CALLBACK('t', "track", &track, "branch",
|
OPT_STRING_LIST('t', "track", &track, "branch",
|
||||||
"branch(es) to track", opt_parse_track),
|
"branch(es) to track"),
|
||||||
OPT_STRING('m', "master", &master, "branch", "master branch"),
|
OPT_STRING('m', "master", &master, "branch", "master branch"),
|
||||||
{ OPTION_CALLBACK, 0, "mirror", &mirror, "push|fetch",
|
{ OPTION_CALLBACK, 0, "mirror", &mirror, "push|fetch",
|
||||||
"set up remote as a mirror to push to or fetch from",
|
"set up remote as a mirror to push to or fetch from",
|
||||||
|
|
Loading…
Reference in New Issue