]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t7403-submodule-sync.sh
submodule sync: do not auto-vivify uninteresting submodule
[thirdparty/git.git] / t / t7403-submodule-sync.sh
index 02522f9627eea8166b2d4709ef3519b23c8dd3d5..fb21b876838c47683bb2c4e8c79db85e2c0412e5 100755 (executable)
@@ -23,7 +23,10 @@ test_expect_success setup '
         git commit -m "submodule"
        ) &&
        git clone super super-clone &&
-       (cd super-clone && git submodule update --init)
+       (cd super-clone && git submodule update --init) &&
+       git clone super empty-clone &&
+       (cd empty-clone && git submodule init) &&
+       git clone super top-only-clone
 '
 
 test_expect_success 'change submodule' '
@@ -64,4 +67,22 @@ test_expect_success '"git submodule sync" should update submodule URLs' '
        )
 '
 
+test_expect_success '"git submodule sync" should update known submodule URLs' '
+       (cd empty-clone &&
+        git pull &&
+        git submodule sync &&
+        test -d "$(git config submodule.submodule.url)"
+       )
+'
+
+test_expect_success '"git submodule sync" should not vivify uninteresting submodule' '
+       (cd top-only-clone &&
+        git pull &&
+        git submodule sync &&
+        test -z "$(git config submodule.submodule.url)" &&
+        git submodule sync submodule &&
+        test -z "$(git config submodule.submodule.url)"
+       )
+'
+
 test_done