chainlint: let here-doc and multi-line string commence on same line
[gitweb.git] / t / t7400-submodule-basic.sh
index d501ab4b613cd351c15c07f7a4fec4c28f6c8981..bfb09dd56615580fd82f8f3d680f45ecd12f9f0e 100755 (executable)
@@ -171,12 +171,13 @@ test_expect_success 'submodule add to .gitignored path with --force' '
 test_expect_success 'submodule add to reconfigure existing submodule with --force' '
        (
                cd addtest-ignore &&
-               git submodule add --force bogus-url submod &&
-               git submodule add -b initial "$submodurl" submod-branch &&
-               test "bogus-url" = "$(git config -f .gitmodules submodule.submod.url)" &&
-               test "bogus-url" = "$(git config submodule.submod.url)" &&
+               bogus_url="$(pwd)/bogus-url" &&
+               git submodule add --force "$bogus_url" submod &&
+               git submodule add --force -b initial "$submodurl" submod-branch &&
+               test "$bogus_url" = "$(git config -f .gitmodules submodule.submod.url)" &&
+               test "$bogus_url" = "$(git config submodule.submod.url)" &&
                # Restore the url
-               git submodule add --force "$submodurl" submod
+               git submodule add --force "$submodurl" submod &&
                test "$submodurl" = "$(git config -f .gitmodules submodule.submod.url)" &&
                test "$submodurl" = "$(git config submodule.submod.url)"
        )
@@ -818,7 +819,7 @@ test_expect_success '../bar/a/b/c works with relative local path - ../foo/bar.gi
                cp pristine-.git-config .git/config &&
                cp pristine-.gitmodules .gitmodules &&
                mkdir -p a/b/c &&
-               (cd a/b/c; git init) &&
+               (cd a/b/c && git init) &&
                git config remote.origin.url ../foo/bar.git &&
                git submodule add ../bar/a/b/c ./a/b/c &&
                git submodule init &&
@@ -839,6 +840,21 @@ test_expect_success 'moving the superproject does not break submodules' '
        )
 '
 
+test_expect_success 'moving the submodule does not break the superproject' '
+       (
+               cd addtest2 &&
+               git submodule status
+       ) >actual &&
+       sed -e "s/^ \([^ ]* repo\) .*/-\1/" <actual >expect &&
+       mv addtest2/repo addtest2/repo.bak &&
+       test_when_finished "mv addtest2/repo.bak addtest2/repo" &&
+       (
+               cd addtest2 &&
+               git submodule status
+       ) >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'submodule add --name allows to replace a submodule with another at the same path' '
        (
                cd addtest2 &&