Fourth batch
[gitweb.git] / t / t7406-submodule-update.sh
index 24aa732312824ab21a712e1b88e3d6098d9aca57..df34c994d2f125e91db663b78412e1e04f637cc8 100755 (executable)
@@ -115,17 +115,17 @@ Submodule path '../super/submodule': checked out '$submodulesha1'
 EOF
 
 cat <<EOF >expect2
+Cloning into '$pwd/recursivesuper/super/merging'...
+Cloning into '$pwd/recursivesuper/super/none'...
+Cloning into '$pwd/recursivesuper/super/rebasing'...
+Cloning into '$pwd/recursivesuper/super/submodule'...
 Submodule 'merging' ($pwd/merging) registered for path '../super/merging'
 Submodule 'none' ($pwd/none) registered for path '../super/none'
 Submodule 'rebasing' ($pwd/rebasing) registered for path '../super/rebasing'
 Submodule 'submodule' ($pwd/submodule) registered for path '../super/submodule'
-Cloning into '$pwd/recursivesuper/super/merging'...
 done.
-Cloning into '$pwd/recursivesuper/super/none'...
 done.
-Cloning into '$pwd/recursivesuper/super/rebasing'...
 done.
-Cloning into '$pwd/recursivesuper/super/submodule'...
 done.
 EOF
 
@@ -137,7 +137,8 @@ test_expect_success 'submodule update --init --recursive from subdirectory' '
         git submodule update --init --recursive ../super >../../actual 2>../../actual2
        ) &&
        test_i18ncmp expect actual &&
-       test_i18ncmp expect2 actual2
+       sort actual2 >actual2.sorted &&
+       test_i18ncmp expect2 actual2.sorted
 '
 
 cat <<EOF >expect2
@@ -157,7 +158,6 @@ test_expect_success 'submodule update --init from and of subdirectory' '
        test_i18ncmp expect2 actual2
 '
 
-apos="'";
 test_expect_success 'submodule update does not fetch already present commits' '
        (cd submodule &&
          echo line3 >> file &&
@@ -167,7 +167,7 @@ test_expect_success 'submodule update does not fetch already present commits' '
        ) &&
        (cd super/submodule &&
          head=$(git rev-parse --verify HEAD) &&
-         echo "Submodule path ${apos}submodule$apos: checked out $apos$head$apos" > ../../expected &&
+         echo "Submodule path ${SQ}submodule$SQ: checked out $SQ$head$SQ" > ../../expected &&
          git reset --hard HEAD~1
        ) &&
        (cd super &&
@@ -606,7 +606,7 @@ test_expect_success 'submodule update - update=none in .git/config but --checkou
         git diff --name-only >out &&
         ! grep ^submodule$ out &&
         (cd submodule &&
-         test_must_fail compare_head
+         ! compare_head
         ) &&
         git config --unset submodule.submodule.update
        )
@@ -788,7 +788,7 @@ test_expect_success 'submodule add places git-dir in superprojects git-dir' '
         (cd .git/modules/deeper/submodule &&
          git log > ../../../../actual
         ) &&
-        test_cmp actual expected
+        test_cmp expected actual
        )
 '
 
@@ -806,7 +806,7 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir' '
         (cd .git/modules/deeper/submodule &&
          git log > ../../../../actual
         ) &&
-        test_cmp actual expected
+        test_cmp expected actual
        )
 '
 
@@ -826,7 +826,7 @@ test_expect_success 'submodule add places git-dir in superprojects git-dir recur
         git add deeper/submodule &&
         git commit -m "update submodule" &&
         git push origin : &&
-        test_cmp actual expected
+        test_cmp expected actual
        )
 '
 
@@ -873,7 +873,7 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir re
         (cd .git/modules/submodule/modules/subsubmodule &&
          git log > ../../../../../actual
         ) &&
-        test_cmp actual expected
+        test_cmp expected actual
        )
 '
 
@@ -942,7 +942,10 @@ test_expect_success 'submodule update clone shallow submodule outside of depth'
                cd super3 &&
                sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp &&
                mv -f .gitmodules.tmp .gitmodules &&
-               test_must_fail git submodule update --init --depth=1 2>actual &&
+               # Some protocol versions (e.g. 2) support fetching
+               # unadvertised objects, so restrict this test to v0.
+               test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
+                       git submodule update --init --depth=1 2>actual &&
                test_i18ngrep "Direct fetching of that commit failed." actual &&
                git -C ../submodule config uploadpack.allowReachableSHA1InWant true &&
                git submodule update --init --depth=1 >actual &&