All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Michael J Gruber" <git@drmicha.warpmail.net>,
	git@vger.kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [PATCH 3/4] option-strings: use OPT_PATH
Date: Mon, 23 Feb 2015 13:07:13 -0800	[thread overview]
Message-ID: <xmqqd250s5fi.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150223182653.GB19904@peff.net> (Jeff King's message of "Mon, 23 Feb 2015 13:26:53 -0500")

Jeff King <peff@peff.net> writes:

> On Mon, Feb 23, 2015 at 05:17:45PM +0100, Michael J Gruber wrote:
>
>> diff --git a/builtin/clone.c b/builtin/clone.c
>> index a9af3f2..15941c5 100644
>> --- a/builtin/clone.c
>> +++ b/builtin/clone.c
>> @@ -80,7 +80,7 @@ static struct option builtin_clone_options[] = {
>>  		    N_("initialize submodules in the clone")),
>>  	OPT_BOOL(0, "recurse-submodules", &option_recursive,
>>  		    N_("initialize submodules in the clone")),
>> -	OPT_STRING(0, "template", &option_template, N_("template-directory"),
>> +	OPT_PATH(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),
>
> I'm not sure if this one is doing anything. Clone cannot use SETUP_GIT
> for obvious reasons, so we should have a NULL prefix here. But that also
> means we should be doing the right thing already.

I somehow thought that OPT_FILENAME already used expand_user_path()
but apparently it does not.  It may want to.

And then this change will start to matter, as a good enhancement.

Of course, if OPT_PATH() is introduced in such a way that the
program that uses the API can ask for "existing" and/or "directory",

    git clone --template=existing-file $URL
    git clone --template=no-such-directory $URL

can be diagnosed as an error without the program having to code very
much.

So, I agree that this change does not do anything in the current
codebase, but it goes in a right direction.

  reply	other threads:[~2015-02-23 21:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23 14:16 [PATCH] checkout: --to requires directory Michael J Gruber
2015-02-23 14:42 ` Jeff King
2015-02-23 15:01   ` Michael J Gruber
2015-02-23 16:17   ` [PATCH 0/4] OPT_{FILENAME,PATH} Michael J Gruber
2015-02-23 16:17     ` [PATCH 1/4] parse-options: introduce OPT_PATH Michael J Gruber
2015-02-23 19:23       ` Junio C Hamano
2015-02-24 15:49         ` Michael J Gruber
2015-02-23 20:06       ` Philip Oakley
2015-02-23 16:17     ` [PATCH 2/4] option-strings: use OPT_FILENAME Michael J Gruber
2015-02-23 17:44       ` Jeff King
2015-02-23 19:08       ` Junio C Hamano
2015-02-23 20:31         ` Junio C Hamano
2015-02-23 16:17     ` [PATCH 3/4] option-strings: use OPT_PATH Michael J Gruber
2015-02-23 18:26       ` Jeff King
2015-02-23 21:07         ` Junio C Hamano [this message]
2015-02-23 21:12           ` Jeff King
2015-02-23 16:17     ` [PATCH 4/4] checkout: --to requires directory Michael J Gruber
2015-02-24  0:34 ` [PATCH] " Duy Nguyen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqd250s5fi.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.