clone: use OPT_STRING_LIST for --reference
Not only does this save us having to implement a custom callback, but it handles "--no-reference" in the usual way (to clear the list). The generic callback does copy the string, which we don't technically need, but that should not hurt anything. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
May 21, 2015 at 00:15 UTC
8ade009c952b2977508d6d88aacc290c645125d2
1 file changed
+2
-11
builtin/clone.c
+2
-11
@@ -51,15 +51,6 @@ static struct string_list option_config;
51
static struct string_list option_reference;
52
static int option_dissociate;
53
54
-static int opt_parse_reference(const struct option *opt, const char *arg, int unset)
55
-{
56
- struct string_list *option_reference = opt->value;
57
- if (!arg)
58
- return -1;
59
- string_list_append(option_reference, arg);
60
- return 0;
61
-}
62
-
54
static struct option builtin_clone_options[] = {
55
OPT__VERBOSITY(&option_verbosity),
56
OPT_BOOL(0, "progress", &option_progress,
@@ -83,8 +74,8 @@ static struct option builtin_clone_options[] = {
74
N_("initialize submodules in the clone")),
75
OPT_STRING(0, "template", &option_template, N_("template-directory"),
76
N_("directory from which templates will be used")),
86
- OPT_CALLBACK(0 , "reference", &option_reference, N_("repo"),
87
- N_("reference repository"), &opt_parse_reference),
77
+ OPT_STRING_LIST(0, "reference", &option_reference, N_("repo"),
78
+ N_("reference repository")),
79
OPT_STRING('o', "origin", &option_origin, N_("name"),
80
N_("use <name> instead of 'origin' to track upstream")),
81
OPT_STRING('b', "branch", &option_branch, N_("branch"),