summaryrefslogtreecommitdiff
path: root/t/t7408-submodule-reference.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-05-30 14:04:09 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-05-30 14:04:09 +0900
commit2a98a8794eac7089d4e44f51b19e358a14eb6d3e (patch)
treebcd3161145577f27c0b66e332b843ebfd52bff9f /t/t7408-submodule-reference.sh
parentMerge branch 'sg/complete-paths' (diff)
parentsubmodule: add --dissociate option to add/update commands (diff)
downloadtgif-2a98a8794eac7089d4e44f51b19e358a14eb6d3e.tar.xz
Merge branch 'cf/submodule-progress-dissociate'
"git submodule update" and "git submodule add" supported the "--reference" option to borrow objects from a neighbouring local repository like "git clone" does, but lacked the more recent invention "--dissociate". Also "git submodule add" has been taught to take the "--progress" option. * cf/submodule-progress-dissociate: submodule: add --dissociate option to add/update commands submodule: add --progress option to add command submodule: clean up substitutions in script
Diffstat (limited to 't/t7408-submodule-reference.sh')
-rwxr-xr-xt/t7408-submodule-reference.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh
index e159fc5035..08d9add05e 100755
--- a/t/t7408-submodule-reference.sh
+++ b/t/t7408-submodule-reference.sh
@@ -59,6 +59,16 @@ test_expect_success 'submodule add --reference uses alternates' '
test_alternate_is_used super/.git/modules/sub/objects/info/alternates super/sub
'
+test_expect_success 'submodule add --reference with --dissociate does not use alternates' '
+ (
+ cd super &&
+ git submodule add --reference ../B --dissociate "file://$base_dir/A" sub-dissociate &&
+ git commit -m B-super-added &&
+ git repack -ad
+ ) &&
+ test_path_is_missing super/.git/modules/sub-dissociate/objects/info/alternates
+'
+
test_expect_success 'that reference gets used with add' '
(
cd super/sub &&
@@ -82,6 +92,13 @@ test_expect_success 'updating superproject keeps alternates' '
test_alternate_is_used super-clone/.git/modules/sub/objects/info/alternates super-clone/sub
'
+test_expect_success 'updating superproject with --dissociate does not keep alternates' '
+ test_when_finished "rm -rf super-clone" &&
+ git clone super super-clone &&
+ git -C super-clone submodule update --init --reference ../B --dissociate &&
+ test_path_is_missing super-clone/.git/modules/sub/objects/info/alternates
+'
+
test_expect_success 'submodules use alternates when cloning a superproject' '
test_when_finished "rm -rf super-clone" &&
git clone --reference super --recursive super super-clone &&