On Mon, Apr 25, 2016 at 2:04 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Stefan Beller <sbeller@xxxxxxxxxx> writes: > >> This replaces origin/sb/clone-shallow-passthru. >> @@ -190,7 +190,11 @@ objects from the source repository into a pack in the cloned repository. >> >> --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 superproject clone, but full submodules, >> + also pass `--no-shallow-submodules`. > > This is not wrong per-se but the early half of the new text seems to > come from 28a1b569 (docs: clarify that passing --depth to git-clone > implies --single-branch, 2016-01-06), which was merged to 'master' > some time ago. > > I've resolved the conflicts coming from the duplicates, so no need > to resend, but the resulting history would become misleading. I am > undecided if I should rebasing this on top of 85705cfb (Merge branch > 'ss/clone-depth-single-doc', 2016-01-20) or later. I could reroll with another variable name on top of 85705cfb? > >> diff --git a/t/t5614-clone-submodules.sh b/t/t5614-clone-submodules.sh >> new file mode 100755 >> index 0000000..825f511 >> --- /dev/null >> +++ b/t/t5614-clone-submodules.sh >> @@ -0,0 +1,85 @@ >> +#!/bin/sh >> + >> +test_description='Test shallow cloning of repos with submodules' >> + >> +. ./test-lib.sh >> + >> +p=$(pwd) > > A single-letter lower-case global that needs to stay constant for > the entire file looks like a ticking time bomb screaming to be > broken by future updates. I agree. How about `currentdir`, `testdir` or `testtop` instead? That is slightly longer than `D`, `here` or `top`, but is slightly more informative. $TRASH would also work for me. Talking about time bombs: I see there are many tests in single files (e.g. 7412 has ~80 tests IIRC and adding a test in there I often spend more time figuring out the current state of the testing directory rather than writing the test. So I'd rather see more testing files with fewer tests rather than a few files with all the tests for one topic. (e.g. these tests could have gone into the clone tests, or the basic submodule tests, but instead I chose a new file to test this.) > I see $D used for this purpose in many > scripts, $here and $top in some, and $TRASH in yet some others. > Perhaps $D may be more appropriate if we wanted to keep this > ultra-short-and-cryptic while mimicking existing ones. I was not keen on being ultrashort, rather I was toying around to drop the patch introducing the --no-local option. > >> +test_expect_success 'setup' ' >> + git checkout -b master && >> + test_commit commit1 && >> + test_commit commit2 && >> + mkdir sub && >> + ( >> + cd sub && >> + git init && >> + test_commit subcommit1 && >> + test_commit subcommit2 && >> + test_commit subcommit3 >> + ) && >> + git submodule add "file://$p/sub" sub && >> + git commit -m "add submodule" >> +' >> + >> +test_expect_success 'nonshallow clone implies nonshallow submodule' ' >> + test_when_finished "rm -rf super_clone" && >> + git clone --recurse-submodules "file://$p/." super_clone && >> + ( >> + cd super_clone && >> + git log --oneline >lines && >> + test_line_count = 3 lines >> + ) && >> + ( >> + cd super_clone/sub && >> + git log --oneline >lines && >> + test_line_count = 3 lines >> + ) >> +' >> + >> +test_expect_success 'shallow clone implies shallow submodule' ' >> + test_when_finished "rm -rf super_clone" && >> + git clone --recurse-submodules --depth 2 "file://$p/." super_clone && >> + ( >> + cd super_clone && >> + git log --oneline >lines && >> + test_line_count = 2 lines >> + ) && >> + ( >> + cd super_clone/sub && >> + git log --oneline >lines && >> + test_line_count = 1 lines >> + ) >> +' >> + >> +test_expect_success 'shallow clone with non shallow submodule' ' >> + test_when_finished "rm -rf super_clone" && >> + git clone --recurse-submodules --depth 2 --no-shallow-submodules "file://$p/." super_clone && >> + ( >> + cd super_clone && >> + git log --oneline >lines && >> + test_line_count = 2 lines >> + ) && >> + ( >> + cd super_clone/sub && >> + git log --oneline >lines && >> + test_line_count = 3 lines >> + ) >> +' >> + >> +test_expect_success 'non shallow clone with shallow submodule' ' >> + test_when_finished "rm -rf super_clone" && >> + git clone --recurse-submodules --no-local --shallow-submodules "file://$p/." super_clone && >> + ( >> + cd super_clone && >> + git log --oneline >lines && >> + test_line_count = 3 lines >> + ) && >> + ( >> + cd super_clone/sub && >> + git log --oneline >lines && >> + test_line_count = 1 lines >> + ) >> +' >> + >> +test_done -- 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