Merge branch 'jn/post-receive-utf8'
[gitweb.git] / t / t7400-submodule-basic.sh
index 50e6ad7458c48842408e2afc20f84c117120c262..4192fe0ec6025979caea01885925c1786a4fcf63 100755 (executable)
@@ -18,6 +18,16 @@ test_expect_success 'setup - initial commit' '
        git branch initial
 '
 
+test_expect_success 'configuration parsing' '
+       test_when_finished "rm -f .gitmodules" &&
+       cat >.gitmodules <<-\EOF &&
+       [submodule "s"]
+               path
+               ignore
+       EOF
+       test_must_fail git status
+'
+
 test_expect_success 'setup - repository in init subdirectory' '
        mkdir init &&
        (
@@ -773,13 +783,11 @@ test_expect_success 'submodule add --name allows to replace a submodule with ano
                        test_cmp expect .git
                ) &&
                echo "repo" >expect &&
-               git config -f .gitmodules submodule.repo.path >actual &&
-               test_cmp expect actual &&
+               test_must_fail git config -f .gitmodules submodule.repo.path &&
                git config -f .gitmodules submodule.repo_new.path >actual &&
                test_cmp expect actual&&
                echo "$submodurl/repo" >expect &&
-               git config -f .gitmodules submodule.repo.url >actual &&
-               test_cmp expect actual &&
+               test_must_fail git config -f .gitmodules submodule.repo.url &&
                echo "$submodurl/bare.git" >expect &&
                git config -f .gitmodules submodule.repo_new.url >actual &&
                test_cmp expect actual &&
@@ -799,12 +807,8 @@ test_expect_success 'submodule add with an existing name fails unless forced' '
                git rm repo &&
                test_must_fail git submodule add -q --name repo_new "$submodurl/repo.git" repo &&
                test ! -d repo &&
-               echo "repo" >expect &&
-               git config -f .gitmodules submodule.repo_new.path >actual &&
-               test_cmp expect actual&&
-               echo "$submodurl/bare.git" >expect &&
-               git config -f .gitmodules submodule.repo_new.url >actual &&
-               test_cmp expect actual &&
+               test_must_fail git config -f .gitmodules submodule.repo_new.path &&
+               test_must_fail git config -f .gitmodules submodule.repo_new.url &&
                echo "$submodurl/bare.git" >expect &&
                git config submodule.repo_new.url >actual &&
                test_cmp expect actual &&
@@ -963,4 +967,20 @@ test_expect_success 'submodule with UTF-8 name' '
        git submodule >&2 &&
        test -n "$(git submodule | grep "$svname")"
 '
+
+test_expect_success 'submodule add clone shallow submodule' '
+       mkdir super &&
+       pwd=$(pwd)
+       (
+               cd super &&
+               git init &&
+               git submodule add --depth=1 file://"$pwd"/example2 submodule &&
+               (
+                       cd submodule &&
+                       test 1 = $(git log --oneline | wc -l)
+               )
+       )
+'
+
+
 test_done