On Sun, Sep 14, 2014 at 6:38 AM, Cole Minnaar <cole.minnaar@xxxxxxxxx> 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@xxxxxxxxx> > --- > 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 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html