From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Cc: Michael Haggerty <mhagger@alum.mit.edu>,
Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 1/3] clone: use OPT_STRING_LIST for --reference
Date: Thu, 21 May 2015 00:15:19 -0400 [thread overview]
Message-ID: <20150521041519.GA5196@peff.net> (raw)
In-Reply-To: <20150521041435.GA18978@peff.net>
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>
---
builtin/clone.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index 166a645..1426ef5 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -51,15 +51,6 @@ static struct string_list option_config;
static struct string_list option_reference;
static int option_dissociate;
-static int opt_parse_reference(const struct option *opt, const char *arg, int unset)
-{
- struct string_list *option_reference = opt->value;
- if (!arg)
- return -1;
- string_list_append(option_reference, arg);
- return 0;
-}
-
static struct option builtin_clone_options[] = {
OPT__VERBOSITY(&option_verbosity),
OPT_BOOL(0, "progress", &option_progress,
@@ -83,8 +74,8 @@ static struct option builtin_clone_options[] = {
N_("initialize submodules in the clone")),
OPT_STRING(0, "template", &option_template, N_("template-directory"),
N_("directory from which templates will be used")),
- OPT_CALLBACK(0 , "reference", &option_reference, N_("repo"),
- N_("reference repository"), &opt_parse_reference),
+ OPT_STRING_LIST(0, "reference", &option_reference, N_("repo"),
+ N_("reference repository")),
OPT_STRING('o', "origin", &option_origin, N_("name"),
N_("use <name> instead of 'origin' to track upstream")),
OPT_STRING('b', "branch", &option_branch, N_("branch"),
--
2.4.1.528.g00591e3
next prev parent reply other threads:[~2015-05-21 4:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 4:14 [PATCH/RFC 0/3] --seed as an alias for --dissociate --reference Jeff King
2015-05-21 4:15 ` Jeff King [this message]
2015-05-21 4:16 ` [PATCH 2/3] clone: reorder --dissociate and --reference options Jeff King
2015-05-21 4:16 ` [PATCH 3/3] clone: add `--seed` shorthand Jeff King
2015-05-21 16:05 ` Johannes Schindelin
2015-05-21 19:45 ` Philip Oakley
2015-05-22 6:37 ` Johannes Schindelin
2015-05-22 6:49 ` Jeff King
2015-05-24 19:07 ` Junio C Hamano
2015-05-27 8:19 ` Jeff King
2015-05-27 19:35 ` Junio C Hamano
2015-05-22 6:50 ` Jeff King
2015-05-21 5:01 ` [PATCH/RFC 0/3] --seed as an alias for --dissociate --reference Junio C Hamano
2015-05-21 5:06 ` Jeff King
2015-05-21 16:41 ` Junio C Hamano
2015-05-24 23:53 ` Michael Haggerty
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150521041519.GA5196@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mhagger@alum.mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).