]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t7408-submodule-reference.sh
Sync with 2.17.3
[thirdparty/git.git] / t / t7408-submodule-reference.sh
index e159fc5035d08eee2c1577afd2ac792ddce2934c..08d9add05e0868980f1b59412997e4598e5f9576 100755 (executable)
@@ -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 &&