From: Eric Sunshine <sunshine@sunshineco.com>
To: Cole Minnaar <cole.minnaar@gmail.com>
Cc: Git List <git@vger.kernel.org>, Jens Lehmann <Jens.Lehmann@web.de>
Subject: Re: [PATCH/RFC 1/2] submodule: add ability to shallowly clone any branch in a repo as a submodule
Date: Sun, 14 Sep 2014 19:41:43 -0400 [thread overview]
Message-ID: <CAPig+cSdJGzbwWGQTTO1JJpHSk9gfZcdCqFmG4DeSDewDbgbXQ@mail.gmail.com> (raw)
In-Reply-To: <ede7b63c6028591281a7eefea5e9cd45cccd0a93.1410691049.git.cole.minnaar@gmail.com>
On Sun, Sep 14, 2014 at 6:38 AM, Cole Minnaar <cole.minnaar@gmail.com> wrote:
> Currently when specifying the `--depth` option to the 'submodule add'
> command, it can only create a shallow submodule clone of the currently
> active branch from the cloned repository. If a branch is specified using
> the `--branch` option, and the `--depth` option is also specified, the
> 'submodule add' command will result in an error as the branch will not
> be present in the cloned repository. If a repository is shallowly cloned
> as a submodule, there is no way to specify that the shallowly cloned
> submodule should setup remote-tracking branches.
>
> Added the ability to shallowly clone any branch as a submodule, not just
> the current active branch in the cloned repository.
> Added support to the 'submodule add' and 'submodule update' commands to
> handle `--no-single-branch` option, which is in turn passed to the clone
> command in order to setup remote-tracking branches in the shallowly
> cloned submodule.
>
> Signed-off-by: Cole Minnaar <cole.minnaar@gmail.com>
> ---
> diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
> index 7c88245..81c05ae 100755
> --- a/t/t7400-submodule-basic.sh
> +++ b/t/t7400-submodule-basic.sh
> @@ -136,7 +136,6 @@ test_expect_success 'submodule add --branch' '
> echo "refs/heads/initial" >expect-head &&
> cat <<-\EOF >expect-heads &&
> refs/heads/initial
> - refs/heads/master
> EOF
> >empty &&
>
> @@ -982,5 +981,37 @@ test_expect_success 'submodule add clone shallow submodule' '
> )
> '
>
> +test_expect_success 'submodule add --branch --depth' '
> + (
> + cd addtest2 &&
> + git submodule add -b initial --depth 1 -- file://"$submodurl" submod-branch-depth &&
> + test "initial" = "$(git config -f .gitmodules submodule.submod-branch-depth.branch)" &&
> + (
> + cd submod-branch-depth &&
> + test 1 = $(git log --oneline | wc -l)
> + )
> + )
> +'
> +
> +cat >remote <<\EOF
> + origin/HEAD -> origin/second
> + origin/initial
> + origin/master
> + origin/second
> +EOF
> +
> +test_expect_success 'submodule add --branch --depth --no-single-branch' '
> + (
> + cd addtest2 &&
> + git submodule add -b initial --depth 1 --no-single-branch -- file://"$submodurl" submod-branch-depth-all &&
> + test "initial" = "$(git config -f .gitmodules submodule.submod-branch-depth-all.branch)" &&
> + (
> + cd submod-branch-depth-all &&
> + test 1 = $(git log --oneline | wc -l)
Broken &&-chain.
> + git branch -r >../../remote-out
> + )
> + ) &&
> + test_cmp remote remote-out
> +'
>
> test_done
> --
> 2.1.0.238.gce1d3a9.dirty
prev parent reply other threads:[~2014-09-14 23:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-14 10:38 [PATCH/RFC 1/2] submodule: add ability to shallowly clone any branch in a repo as a submodule Cole Minnaar
2014-09-14 10:38 ` [PATCH/RFC 2/2] submodule: modify clone command to recursively shallow clone submodules Cole Minnaar
2014-09-14 23:41 ` Eric Sunshine [this message]
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=CAPig+cSdJGzbwWGQTTO1JJpHSk9gfZcdCqFmG4DeSDewDbgbXQ@mail.gmail.com \
--to=sunshine@sunshineco.com \
--cc=Jens.Lehmann@web.de \
--cc=cole.minnaar@gmail.com \
--cc=git@vger.kernel.org \
/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).