summaryrefslogtreecommitdiff
path: root/t/t5614-clone-submodules.sh
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2016-05-26 21:59:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-05-27 17:40:46 (GMT)
commitabed000acafd8aa86e02bcbb65fc1a8e4f06b8a0 (patch)
treededda0e06c5bcf2af6a694fffba498f0fa7607bd /t/t5614-clone-submodules.sh
parent37f52e93441e1da00c9c9824ed03cd074d77f43a (diff)
downloadgit-abed000acafd8aa86e02bcbb65fc1a8e4f06b8a0.zip
git-abed000acafd8aa86e02bcbb65fc1a8e4f06b8a0.tar.gz
git-abed000acafd8aa86e02bcbb65fc1a8e4f06b8a0.tar.bz2
submodule update: learn `--[no-]recommend-shallow` option
Sometimes the history of a submodule is not considered important by the projects upstream. To make it easier for downstream users, allow a boolean field 'submodule.<name>.shallow' in .gitmodules, which can be used to recommend whether upstream considers the history important. This field is honored in the initial clone by default, it can be ignored by giving the `--no-recommend-shallow` option. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5614-clone-submodules.sh')
-rwxr-xr-xt/t5614-clone-submodules.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/t/t5614-clone-submodules.sh b/t/t5614-clone-submodules.sh
index 62044c5..32d83e2 100755
--- a/t/t5614-clone-submodules.sh
+++ b/t/t5614-clone-submodules.sh
@@ -82,4 +82,56 @@ test_expect_success 'non shallow clone with shallow submodule' '
)
'
+test_expect_success 'clone follows shallow recommendation' '
+ test_when_finished "rm -rf super_clone" &&
+ git config -f .gitmodules submodule.sub.shallow true &&
+ git add .gitmodules &&
+ git commit -m "recommed shallow for sub" &&
+ git clone --recurse-submodules --no-local "file://$pwd/." super_clone &&
+ (
+ cd super_clone &&
+ git log --oneline >lines &&
+ test_line_count = 4 lines
+ ) &&
+ (
+ cd super_clone/sub &&
+ git log --oneline >lines &&
+ test_line_count = 1 lines
+ )
+'
+
+test_expect_success 'get unshallow recommended shallow submodule' '
+ test_when_finished "rm -rf super_clone" &&
+ git clone --no-local "file://$pwd/." super_clone &&
+ (
+ cd super_clone &&
+ git submodule update --init --no-recommend-shallow &&
+ git log --oneline >lines &&
+ test_line_count = 4 lines
+ ) &&
+ (
+ cd super_clone/sub &&
+ git log --oneline >lines &&
+ test_line_count = 3 lines
+ )
+'
+
+test_expect_success 'clone follows non shallow recommendation' '
+ test_when_finished "rm -rf super_clone" &&
+ git config -f .gitmodules submodule.sub.shallow false &&
+ git add .gitmodules &&
+ git commit -m "recommed non shallow for sub" &&
+ git clone --recurse-submodules --no-local "file://$pwd/." super_clone &&
+ (
+ cd super_clone &&
+ git log --oneline >lines &&
+ test_line_count = 5 lines
+ ) &&
+ (
+ cd super_clone/sub &&
+ git log --oneline >lines &&
+ test_line_count = 3 lines
+ )
+'
+
test_done