Merge branch 'ep/varscope'
[gitweb.git] / t / t7406-submodule-update.sh
index bc7cfcd835a22fbfcdd2105aa8c2410884a52cb2..0246e80b1af98fe213b06beb8de0a9fec464b9f2 100755 (executable)
@@ -58,7 +58,7 @@ test_expect_success 'setup a submodule tree' '
         git submodule add ../merging merging &&
         test_tick &&
         git commit -m "rebasing"
-       )
+       ) &&
        (cd super &&
         git submodule add ../none none &&
         test_tick &&
@@ -323,6 +323,21 @@ test_expect_success 'submodule update - command in .git/config catches failure'
        )
 '
 
+test_expect_success 'submodule init does not copy command into .git/config' '
+       (cd super &&
+        H=$(git ls-files -s submodule | cut -d" " -f2) &&
+        mkdir submodule1 &&
+        git update-index --add --cacheinfo 160000 $H submodule1 &&
+        git config -f .gitmodules submodule.submodule1.path submodule1 &&
+        git config -f .gitmodules submodule.submodule1.url ../submodule &&
+        git config -f .gitmodules submodule.submodule1.update !false &&
+        git submodule init submodule1 &&
+        echo "none" >expect &&
+        git config submodule.submodule1.update >actual &&
+        test_cmp expect actual
+       )
+'
+
 test_expect_success 'submodule init picks up rebase' '
        (cd super &&
         git config -f .gitmodules submodule.rebasing.update rebase &&
@@ -729,13 +744,34 @@ test_expect_success 'submodule update properly revives a moved submodule' '
 test_expect_success SYMLINKS 'submodule update can handle symbolic links in pwd' '
        mkdir -p linked/dir &&
        ln -s linked/dir linkto &&
-       (
-               cd linkto &&
-               git clone "$TRASH_DIRECTORY"/super_update_r2 super &&
-               (
-                       cd super &&
-                       git submodule update --init --recursive
-               )
+       (cd linkto &&
+        git clone "$TRASH_DIRECTORY"/super_update_r2 super &&
+        (cd super &&
+         git submodule update --init --recursive
+        )
+       )
+'
+
+test_expect_success 'submodule update clone shallow submodule' '
+       git clone cloned super3 &&
+       pwd=$(pwd)
+       (cd super3 &&
+        sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp &&
+        mv -f .gitmodules.tmp .gitmodules &&
+        git submodule update --init --depth=3
+        (cd submodule &&
+         test 1 = $(git log --oneline | wc -l)
+        )
+)
+'
+
+test_expect_success 'submodule update --recursive drops module name before recursing' '
+       (cd super2 &&
+        (cd deeper/submodule/subsubmodule &&
+         git checkout HEAD^
+        ) &&
+        git submodule update --recursive deeper/submodule >actual &&
+        test_i18ngrep "Submodule path .deeper/submodule/subsubmodule.: checked out" actual
        )
 '