Skip to content

Commit 8ade009

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9a3d637 commit 8ade009

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

builtin/clone.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,6 @@ static struct string_list option_config;
5151
static struct string_list option_reference;
5252
static int option_dissociate;
5353

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-
6354
static struct option builtin_clone_options[] = {
6455
OPT__VERBOSITY(&option_verbosity),
6556
OPT_BOOL(0, "progress", &option_progress,
@@ -83,8 +74,8 @@ static struct option builtin_clone_options[] = {
8374
N_("initialize submodules in the clone")),
8475
OPT_STRING(0, "template", &option_template, N_("template-directory"),
8576
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")),
8879
OPT_STRING('o', "origin", &option_origin, N_("name"),
8980
N_("use <name> instead of 'origin' to track upstream")),
9081
OPT_STRING('b', "branch", &option_branch, N_("branch"),

0 commit comments

Comments
 (0)