git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Lars Schneider <larsxschneider@gmail.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCH 1/3] submodule clone: pass along `local` option
Date: Mon, 25 Apr 2016 10:15:50 -0700	[thread overview]
Message-ID: <CAGZ79kZ-jszUtk4R+nWidmjGBFwAwymgr+nzghGSyUVqx=Y5-Q@mail.gmail.com> (raw)
In-Reply-To: <65302315-2C33-4801-887C-9AF3CB2F6BB6@gmail.com>

On Mon, Apr 25, 2016 at 5:18 AM, Lars Schneider
<larsxschneider@gmail.com> wrote:
>> @@ -140,6 +141,10 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url
>>               argv_array_pushl(&cp.args, "--reference", reference, NULL);
>>       if (gitdir && *gitdir)
>>               argv_array_pushl(&cp.args, "--separate-git-dir", gitdir, NULL);
>> +     if (local == 1)
> bikeshedding: Why do you use == 1 here and !local below? I would either compare both against
> integers or none ("if (local)" should work here, too, no?). Or is this a Git coding guideline
> that I am not yet aware of?

"if (local)" doesn't work as it includes -1 as well.
What I want to express here is:

    switch (local) {
    case 1: argv_array_push(&cp.args, "--local"); break; /* local == 1
did that */
    case 0: argv_array_push(&cp.args, "--no-local"); break; /* !local*/
    case -1: default: /* pass nothing */
    }

This seems to be more expressive now, so I'll replace with that?

>> @@ -180,6 +186,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
>>               OPT_STRING(0, "depth", &depth,
>>                          N_("string"),
>>                          N_("depth for shallow clones")),
>> +             OPT_BOOL(0, "local", &local,
>> +                      N_("to clone from a local repository")),
> TBH I think "local" could be misleading here. How about "--pass-transfer-protocol-on-to-submodules"
> or something? If I understand this option correctly then this could be useful for other cases besides
> "local". Imagine you clone a repo via HTTPS that has references to SSH submodules on the same
> server. If you don't have a proper SSH setup then the submodule clone will fail.

Good point. We just converted an internal repository to use relative
path for submodules instead of
absolute paths and that broke the auth (they used different protocols,
which we were unaware of)

However  "--pass-transfer-protocol-on-to-submodules" would mean more
than just "--[no-]local,
but also passing on the protocol prefix (which can be http://,
https://, ssh://, git:// or more),
so it would enlarge the scope of this series a lot. (Original purpose
of this patch was to allow
not using the explicit file:// protocol in the test for the next
patch. But I see passing on the protocol
as a new issue worth resolving :)

  reply	other threads:[~2016-04-25 17:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 23:48 [PATCH 0/3] clone --shallow-submodules flag Stefan Beller
2016-04-12 23:48 ` [PATCH 1/3] submodule clone: pass along `local` option Stefan Beller
2016-04-25 12:18   ` Lars Schneider
2016-04-25 17:15     ` Stefan Beller [this message]
2016-04-12 23:48 ` [PATCH 2/3] clone: add `--shallow-submodules` flag Stefan Beller
2016-04-12 23:48 ` [PATCH 3/3] clone: add t5614 to test cloning submodules with shallowness involved Stefan Beller
2016-04-13  6:52   ` Jacob Keller
2016-04-25 17:41     ` Stefan Beller
2016-04-25 12:25   ` Lars Schneider

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='CAGZ79kZ-jszUtk4R+nWidmjGBFwAwymgr+nzghGSyUVqx=Y5-Q@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jacob.keller@gmail.com \
    --cc=larsxschneider@gmail.com \
    /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).