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>,
Jonathan Nieder <jrnieder@gmail.com>,
Jens Lehmann <Jens.Lehmann@web.de>,
Duy Nguyen <pclouds@gmail.com>
Subject: Re: [PATCH 1/3] clone: add `--shallow-submodules` flag
Date: Mon, 25 Apr 2016 10:26:11 -0700 [thread overview]
Message-ID: <CAGZ79kYJipjCVGFXQkHyLNr4GTZA+vJFv+-8bWDXTrN3VUORuA@mail.gmail.com> (raw)
In-Reply-To: <DC38BBF1-9837-45C6-B744-F95FAA645FE3@gmail.com>
On Mon, Apr 25, 2016 at 4:50 AM, Lars Schneider
<larsxschneider@gmail.com> wrote:
>> first case (as we wouldd have already transmitted the non shallow over
> s/wouldd/would/
will be fixed in a reroll
>> --depth <depth>::
>> Create a 'shallow' clone with a history truncated to the
>> - specified number of revisions.
>> + specified number of revisions. Implies `--single-branch` unless
>> + `--no-single-branch` is given to fetch the histories near the
>> + tips of all branches. This implies `--shallow-submodules`. If
>> + you want to have a shallow clone, but full submodules, also pass
> Can we make this more explicit. Attention, bikeshedding:
> If you want to have a shallow parent clone, but full submodules...
Good point, but with s/parent/superproject/ ? (What is a "parent clone"?
It is not defined in the glossary, so let's not make up more confusing words
for Git here :)
>
>
>> + `--no-shallow-submodules`.
>>
>> --[no-]single-branch::
>> Clone only the history leading to the tip of a single branch,
>> @@ -214,6 +218,9 @@ objects from the source repository into a pack in the cloned repository.
>> repository does not have a worktree/checkout (i.e. if any of
>> `--no-checkout`/`-n`, `--bare`, or `--mirror` is given)
>>
>> +--shallow-submodules::
> Should that be "--[no-]shallow-submodules" ?
will be fixed in a reroll
>
>
>> + All submodules which are cloned, will be shallow.
> Maybe you could extend it with "... will be shallow with a depth of 1." ?
done
>
>
>> +
>> --separate-git-dir=<git dir>::
>> Instead of placing the cloned repository where it is supposed
>> to be, place the cloned repository at the specified directory,
>> diff --git a/builtin/clone.c b/builtin/clone.c
>> index b004fb4..ecdf308 100644
>> --- a/builtin/clone.c
>> +++ b/builtin/clone.c
>> @@ -40,6 +40,7 @@ static const char * const builtin_clone_usage[] = {
>>
>> static int option_no_checkout, option_bare, option_mirror, option_single_branch = -1;
>> static int option_local = -1, option_no_hardlinks, option_shared, option_recursive;
>> +static int option_shallow_submodules = -1;
>> static char *option_template, *option_depth;
>> static char *option_origin = NULL;
>> static char *option_branch = NULL;
>> @@ -91,6 +92,8 @@ static struct option builtin_clone_options[] = {
>> N_("create a shallow clone of that depth")),
>> OPT_BOOL(0, "single-branch", &option_single_branch,
>> N_("clone only one branch, HEAD or --branch")),
>> + OPT_BOOL(0, "shallow-submodules", &option_shallow_submodules,
>> + N_("any cloned submodules will be shallow")),
> I am not familiar with this code but I assume the "no-" prefix flips the bool?
Giving the --no-option stores an explicit 0 (it is initialized as -1),
and passing --option stores a 1.
>> @@ -727,6 +730,10 @@ static int checkout(void)
>> struct argv_array args = ARGV_ARRAY_INIT;
>> argv_array_pushl(&args, "submodule", "update", "--init", "--recursive", NULL);
>>
>> + if (option_shallow_submodules == 1
>> + || (option_shallow_submodules == -1 && option_depth))
>> + argv_array_push(&args, "--depth=1");
>> +
which explains this here as:
If --shallow-submodules was given
|| (neither --[no-]shallow-submodules was given, but --depth
was given,
i.e. depth implies --shallow-submodule only if no explicit
choice was made
by the user.
>> if (max_jobs != -1)
>> argv_array_pushf(&args, "--jobs=%d", max_jobs);
>>
>> --
>> 2.7.0.rc0.42.g8e9204f.dirty
>>
>
next prev parent reply other threads:[~2016-04-25 17:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 1:12 [PATCH 0/3] Towards sane shallow clones with submodules Stefan Beller
2016-03-16 1:12 ` [PATCH 1/3] clone: add `--shallow-submodules` flag Stefan Beller
2016-04-25 11:50 ` Lars Schneider
2016-04-25 17:26 ` Stefan Beller [this message]
2016-03-16 1:12 ` [PATCH 2/3] submodule clone: pass along `local` option Stefan Beller
2016-03-16 1:12 ` [PATCH 3/3] clone: Add t5614 to test cloning submodules with shallowness involved Stefan Beller
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=CAGZ79kYJipjCVGFXQkHyLNr4GTZA+vJFv+-8bWDXTrN3VUORuA@mail.gmail.com \
--to=sbeller@google.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=larsxschneider@gmail.com \
--cc=pclouds@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.
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 NNTP newsgroup(s).