3 # Copyright (c) 2007 Lars Hjemli
6 test_description='Basic porcelain support for submodules
8 This test tries to verify basic sanity of the init, update and status
9 subcommands of git submodule.
14 test_expect_success 'setup - initial commit' '
17 git commit -m "initial commit" &&
21 test_expect_success 'configuration parsing' '
22 test_when_finished "rm -f .gitmodules" &&
23 cat >.gitmodules <<-\EOF &&
28 test_must_fail git status
31 test_expect_success 'setup - repository in init subdirectory' '
38 git commit -m "submodule commit 1" &&
39 git tag -a -m "rev-1" rev-1
43 test_expect_success 'setup - commit with gitlink' '
47 git commit -m "super commit 1"
50 test_expect_success 'setup - hide init subdirectory' '
54 test_expect_success 'setup - repository to add submodules to' '
56 git init addtest-ignore
59 # The 'submodule add' tests need some repository to add as a submodule.
60 # The trash directory is a good one as any. We need to canonicalize
61 # the name, though, as some tests compare it to the absolute path git
62 # generates, which will expand symbolic links.
66 git for-each-ref --format='%(refname)' 'refs/heads/*'
75 listbranches >"$dotdot/heads" &&
76 { git symbolic-ref HEAD || :; } >"$dotdot/head" &&
77 git rev-parse HEAD >"$dotdot/head-sha1" &&
78 git update-index --refresh &&
79 git diff-files --exit-code &&
80 git clean -n -d -x >"$dotdot/untracked"
84 test_expect_success 'submodule add' '
85 echo "refs/heads/master" >expect &&
90 git submodule add -q "$submodurl" submod >actual &&
91 test_must_be_empty actual &&
92 echo "gitdir: ../.git/modules/submod" >expect &&
93 test_cmp expect submod/.git &&
96 git config core.worktree >actual &&
97 echo "../../../submod" >expect &&
98 test_cmp expect actual &&
104 rm -f heads head untracked &&
105 inspect addtest/submod ../.. &&
106 test_cmp expect heads &&
107 test_cmp expect head &&
108 test_cmp empty untracked
111 test_expect_success 'submodule add to .gitignored path fails' '
114 cat <<-\EOF >expect &&
115 The following path is ignored by one of your .gitignore files:
117 Use -f if you really want to add it.
119 # Does not use test_commit due to the ignore
120 echo "*" > .gitignore &&
121 git add --force .gitignore &&
122 git commit -m"Ignore everything" &&
123 ! git submodule add "$submodurl" submod >actual 2>&1 &&
124 test_i18ncmp expect actual
128 test_expect_success 'submodule add to .gitignored path with --force' '
131 git submodule add --force "$submodurl" submod
135 test_expect_success 'submodule add --branch' '
136 echo "refs/heads/initial" >expect-head &&
137 cat <<-\EOF >expect-heads &&
145 git submodule add -b initial "$submodurl" submod-branch &&
146 test "initial" = "$(git config -f .gitmodules submodule.submod-branch.branch)" &&
150 rm -f heads head untracked &&
151 inspect addtest/submod-branch ../.. &&
152 test_cmp expect-heads heads &&
153 test_cmp expect-head head &&
154 test_cmp empty untracked
157 test_expect_success 'submodule add with ./ in path' '
158 echo "refs/heads/master" >expect &&
163 git submodule add "$submodurl" ././dotsubmod/./frotz/./ &&
167 rm -f heads head untracked &&
168 inspect addtest/dotsubmod/frotz ../../.. &&
169 test_cmp expect heads &&
170 test_cmp expect head &&
171 test_cmp empty untracked
174 test_expect_success 'submodule add with /././ in path' '
175 echo "refs/heads/master" >expect &&
180 git submodule add "$submodurl" dotslashdotsubmod/././frotz/./ &&
184 rm -f heads head untracked &&
185 inspect addtest/dotslashdotsubmod/frotz ../../.. &&
186 test_cmp expect heads &&
187 test_cmp expect head &&
188 test_cmp empty untracked
191 test_expect_success 'submodule add with // in path' '
192 echo "refs/heads/master" >expect &&
197 git submodule add "$submodurl" slashslashsubmod///frotz// &&
201 rm -f heads head untracked &&
202 inspect addtest/slashslashsubmod/frotz ../../.. &&
203 test_cmp expect heads &&
204 test_cmp expect head &&
205 test_cmp empty untracked
208 test_expect_success 'submodule add with /.. in path' '
209 echo "refs/heads/master" >expect &&
214 git submodule add "$submodurl" dotdotsubmod/../realsubmod/frotz/.. &&
218 rm -f heads head untracked &&
219 inspect addtest/realsubmod ../.. &&
220 test_cmp expect heads &&
221 test_cmp expect head &&
222 test_cmp empty untracked
225 test_expect_success 'submodule add with ./, /.. and // in path' '
226 echo "refs/heads/master" >expect &&
231 git submodule add "$submodurl" dot/dotslashsubmod/./../..////realsubmod2/a/b/c/d/../../../../frotz//.. &&
235 rm -f heads head untracked &&
236 inspect addtest/realsubmod2 ../.. &&
237 test_cmp expect heads &&
238 test_cmp expect head &&
239 test_cmp empty untracked
242 test_expect_success 'submodule add in subdirectory' '
243 echo "refs/heads/master" >expect &&
249 git submodule add "$submodurl" ../realsubmod3 &&
253 rm -f heads head untracked &&
254 inspect addtest/realsubmod3 ../.. &&
255 test_cmp expect heads &&
256 test_cmp expect head &&
257 test_cmp empty untracked
260 test_expect_success 'submodule add in subdirectory with relative path should fail' '
263 test_must_fail git submodule add ../../ submod3 2>../../output.err
265 test_i18ngrep toplevel output.err
268 test_expect_success 'setup - add an example entry to .gitmodules' '
269 GIT_CONFIG=.gitmodules \
270 git config submodule.example.url git://example.com/init.git
273 test_expect_success 'status should fail for unmapped paths' '
274 test_must_fail git submodule status
277 test_expect_success 'setup - map path in .gitmodules' '
278 cat <<\EOF >expect &&
279 [submodule "example"]
280 url = git://example.com/init.git
284 GIT_CONFIG=.gitmodules git config submodule.example.path init &&
286 test_cmp expect .gitmodules
289 test_expect_success 'status should only print one line' '
290 git submodule status >lines &&
291 test_line_count = 1 lines
294 test_expect_success 'setup - fetch commit name from submodule' '
295 rev1=$(cd .subrepo && git rev-parse HEAD) &&
296 printf "rev1: %s\n" "$rev1" &&
300 test_expect_success 'status should initially be "missing"' '
301 git submodule status >lines &&
305 test_expect_success 'init should register submodule url in .git/config' '
306 echo git://example.com/init.git >expect &&
308 git submodule init &&
309 git config submodule.example.url >url &&
310 git config submodule.example.url ./.subrepo &&
315 test_failure_with_unknown_submodule () {
316 test_must_fail git submodule $1 no-such-submodule 2>output.err &&
317 grep "^error: .*no-such-submodule" output.err
320 test_expect_success 'init should fail with unknown submodule' '
321 test_failure_with_unknown_submodule init
324 test_expect_success 'update should fail with unknown submodule' '
325 test_failure_with_unknown_submodule update
328 test_expect_success 'status should fail with unknown submodule' '
329 test_failure_with_unknown_submodule status
332 test_expect_success 'sync should fail with unknown submodule' '
333 test_failure_with_unknown_submodule sync
336 test_expect_success 'update should fail when path is used by a file' '
337 echo hello >expect &&
339 echo "hello" >init &&
340 test_must_fail git submodule update &&
345 test_expect_success 'update should fail when path is used by a nonempty directory' '
346 echo hello >expect &&
350 echo "hello" >init/a &&
352 test_must_fail git submodule update &&
354 test_cmp expect init/a
357 test_expect_success 'update should work when path is an empty dir' '
360 echo "$rev1" >expect &&
363 git submodule update -q >update.out &&
364 test_must_be_empty update.out &&
367 test_cmp expect head-sha1
370 test_expect_success 'status should be "up-to-date" after update' '
371 git submodule status >list &&
375 test_expect_success 'status "up-to-date" from subdirectory' '
379 git submodule status >../list
381 grep "^ $rev1" list &&
382 grep "\\.\\./init" list
385 test_expect_success 'status "up-to-date" from subdirectory with path' '
389 git submodule status ../init >../list
391 grep "^ $rev1" list &&
392 grep "\\.\\./init" list
395 test_expect_success 'status should be "modified" after submodule commit' '
400 git commit -m "submodule commit 2"
403 rev2=$(cd init && git rev-parse HEAD) &&
405 git submodule status >list &&
410 test_expect_success 'the --cached sha1 should be rev1' '
411 git submodule --cached status >list &&
415 test_expect_success 'git diff should report the SHA1 of the new submodule commit' '
417 grep "^+Subproject commit $rev2" diff
420 test_expect_success 'update should checkout rev1' '
422 echo "$rev1" >expect &&
424 git submodule update init &&
427 test_cmp expect head-sha1
430 test_expect_success 'status should be "up-to-date" after update' '
431 git submodule status >list &&
435 test_expect_success 'checkout superproject with subproject already present' '
436 git checkout initial &&
440 test_expect_success 'apply submodule diff' '
448 git commit -m "change subproject"
450 git update-index --add init &&
451 git commit -m "change init" &&
452 git format-patch -1 --stdout >P.diff &&
453 git checkout second &&
454 git apply --index P.diff &&
456 git diff --cached master >staged &&
457 test_cmp empty staged
460 test_expect_success 'update --init' '
462 git config -f .gitmodules submodule.example.url "$(pwd)/init2" &&
463 git config --remove-section submodule.example &&
464 test_must_fail git config submodule.example.url &&
466 git submodule update init > update.out &&
468 test_i18ngrep "not initialized" update.out &&
469 test_must_fail git rev-parse --resolve-git-dir init/.git &&
471 git submodule update --init init &&
472 git rev-parse --resolve-git-dir init/.git
475 test_expect_success 'update --init from subdirectory' '
477 git config -f .gitmodules submodule.example.url "$(pwd)/init2" &&
478 git config --remove-section submodule.example &&
479 test_must_fail git config submodule.example.url &&
484 git submodule update ../init >update.out &&
486 test_i18ngrep "not initialized" update.out &&
487 test_must_fail git rev-parse --resolve-git-dir ../init/.git &&
489 git submodule update --init ../init
491 git rev-parse --resolve-git-dir init/.git
494 test_expect_success 'do not add files from a submodule' '
497 test_must_fail git add init/a
501 test_expect_success 'gracefully add/reset submodule with a trailing slash' '
504 git commit -m "commit subproject" init &&
508 git diff --exit-code --cached init &&
510 git commit -m update a >/dev/null &&
511 git rev-parse HEAD) &&
513 test_must_fail git diff --exit-code --cached init &&
514 test $commit = $(git ls-files --stage |
515 sed -n "s/^160000 \([^ ]*\).*/\1/p") &&
517 git diff --exit-code --cached init
521 test_expect_success 'ls-files gracefully handles trailing slash' '
523 test "init" = "$(git ls-files init/)"
527 test_expect_success 'moving to a commit without submodule does not leave empty dir' '
531 git checkout initial &&
536 test_expect_success 'submodule <invalid-subcommand> fails' '
537 test_must_fail git submodule no-such-subcommand
540 test_expect_success 'add submodules without specifying an explicit path' '
547 git commit -m "repo commit 1"
549 git clone --bare repo/ bare.git &&
552 git submodule add "$submodurl/repo" &&
553 git config -f .gitmodules submodule.repo.path repo &&
554 git submodule add "$submodurl/bare.git" &&
555 git config -f .gitmodules submodule.bare.path bare
559 test_expect_success 'add should fail when path is used by a file' '
563 test_must_fail git submodule add "$submodurl/repo" file
567 test_expect_success 'add should fail when path is used by an existing directory' '
571 test_must_fail git submodule add "$submodurl/repo" empty-dir
575 test_expect_success 'use superproject as upstream when path is relative and no url is set there' '
578 git submodule add ../repo relative &&
579 test "$(git config -f .gitmodules submodule.relative.url)" = ../repo &&
580 git submodule sync relative &&
581 test "$(git config submodule.relative.url)" = "$submodurl/repo"
585 test_expect_success 'set up for relative path tests' '
597 git config -f .gitmodules submodule.sub.path sub &&
598 git config -f .gitmodules submodule.sub.url ../subrepo &&
599 cp .git/config pristine-.git-config &&
600 cp .gitmodules pristine-.gitmodules
604 test_expect_success '../subrepo works with URL - ssh://hostname/repo' '
607 cp pristine-.git-config .git/config &&
608 cp pristine-.gitmodules .gitmodules &&
609 git config remote.origin.url ssh://hostname/repo &&
610 git submodule init &&
611 test "$(git config submodule.sub.url)" = ssh://hostname/subrepo
615 test_expect_success '../subrepo works with port-qualified URL - ssh://hostname:22/repo' '
618 cp pristine-.git-config .git/config &&
619 cp pristine-.gitmodules .gitmodules &&
620 git config remote.origin.url ssh://hostname:22/repo &&
621 git submodule init &&
622 test "$(git config submodule.sub.url)" = ssh://hostname:22/subrepo
626 # About the choice of the path in the next test:
627 # - double-slash side-steps path mangling issues on Windows
628 # - it is still an absolute local path
629 # - there cannot be a server with a blank in its name just in case the
630 # path is used erroneously to access a //server/share style path
631 test_expect_success '../subrepo path works with local path - //somewhere else/repo' '
634 cp pristine-.git-config .git/config &&
635 cp pristine-.gitmodules .gitmodules &&
636 git config remote.origin.url "//somewhere else/repo" &&
637 git submodule init &&
638 test "$(git config submodule.sub.url)" = "//somewhere else/subrepo"
642 test_expect_success '../subrepo works with file URL - file:///tmp/repo' '
645 cp pristine-.git-config .git/config &&
646 cp pristine-.gitmodules .gitmodules &&
647 git config remote.origin.url file:///tmp/repo &&
648 git submodule init &&
649 test "$(git config submodule.sub.url)" = file:///tmp/subrepo
653 test_expect_success '../subrepo works with helper URL- helper:://hostname/repo' '
656 cp pristine-.git-config .git/config &&
657 cp pristine-.gitmodules .gitmodules &&
658 git config remote.origin.url helper:://hostname/repo &&
659 git submodule init &&
660 test "$(git config submodule.sub.url)" = helper:://hostname/subrepo
664 test_expect_success '../subrepo works with scp-style URL - user@host:repo' '
667 cp pristine-.git-config .git/config &&
668 git config remote.origin.url user@host:repo &&
669 git submodule init &&
670 test "$(git config submodule.sub.url)" = user@host:subrepo
674 test_expect_success '../subrepo works with scp-style URL - user@host:path/to/repo' '
677 cp pristine-.git-config .git/config &&
678 cp pristine-.gitmodules .gitmodules &&
679 git config remote.origin.url user@host:path/to/repo &&
680 git submodule init &&
681 test "$(git config submodule.sub.url)" = user@host:path/to/subrepo
685 test_expect_success '../subrepo works with relative local path - foo' '
688 cp pristine-.git-config .git/config &&
689 cp pristine-.gitmodules .gitmodules &&
690 git config remote.origin.url foo &&
691 # actual: fails with an error
692 git submodule init &&
693 test "$(git config submodule.sub.url)" = subrepo
697 test_expect_success '../subrepo works with relative local path - foo/bar' '
700 cp pristine-.git-config .git/config &&
701 cp pristine-.gitmodules .gitmodules &&
702 git config remote.origin.url foo/bar &&
703 git submodule init &&
704 test "$(git config submodule.sub.url)" = foo/subrepo
708 test_expect_success '../subrepo works with relative local path - ./foo' '
711 cp pristine-.git-config .git/config &&
712 cp pristine-.gitmodules .gitmodules &&
713 git config remote.origin.url ./foo &&
714 git submodule init &&
715 test "$(git config submodule.sub.url)" = subrepo
719 test_expect_success '../subrepo works with relative local path - ./foo/bar' '
722 cp pristine-.git-config .git/config &&
723 cp pristine-.gitmodules .gitmodules &&
724 git config remote.origin.url ./foo/bar &&
725 git submodule init &&
726 test "$(git config submodule.sub.url)" = foo/subrepo
730 test_expect_success '../subrepo works with relative local path - ../foo' '
733 cp pristine-.git-config .git/config &&
734 cp pristine-.gitmodules .gitmodules &&
735 git config remote.origin.url ../foo &&
736 git submodule init &&
737 test "$(git config submodule.sub.url)" = ../subrepo
741 test_expect_success '../subrepo works with relative local path - ../foo/bar' '
744 cp pristine-.git-config .git/config &&
745 cp pristine-.gitmodules .gitmodules &&
746 git config remote.origin.url ../foo/bar &&
747 git submodule init &&
748 test "$(git config submodule.sub.url)" = ../foo/subrepo
752 test_expect_success '../bar/a/b/c works with relative local path - ../foo/bar.git' '
755 cp pristine-.git-config .git/config &&
756 cp pristine-.gitmodules .gitmodules &&
758 (cd a/b/c; git init) &&
759 git config remote.origin.url ../foo/bar.git &&
760 git submodule add ../bar/a/b/c ./a/b/c &&
761 git submodule init &&
762 test "$(git config submodule.a/b/c.url)" = ../foo/bar/a/b/c
766 test_expect_success 'moving the superproject does not break submodules' '
769 git submodule status >expect
771 mv addtest addtest2 &&
774 git submodule status >actual &&
775 test_cmp expect actual
779 test_expect_success 'submodule add --name allows to replace a submodule with another at the same path' '
784 echo "$submodurl/repo" >expect &&
785 git config remote.origin.url >actual &&
786 test_cmp expect actual &&
787 echo "gitdir: ../.git/modules/repo" >expect &&
792 git submodule add -q --name repo_new "$submodurl/bare.git" repo >actual &&
793 test_must_be_empty actual &&
794 echo "gitdir: ../.git/modules/submod" >expect &&
795 test_cmp expect submod/.git &&
798 echo "$submodurl/bare.git" >expect &&
799 git config remote.origin.url >actual &&
800 test_cmp expect actual &&
801 echo "gitdir: ../.git/modules/repo_new" >expect &&
804 echo "repo" >expect &&
805 test_must_fail git config -f .gitmodules submodule.repo.path &&
806 git config -f .gitmodules submodule.repo_new.path >actual &&
807 test_cmp expect actual&&
808 echo "$submodurl/repo" >expect &&
809 test_must_fail git config -f .gitmodules submodule.repo.url &&
810 echo "$submodurl/bare.git" >expect &&
811 git config -f .gitmodules submodule.repo_new.url >actual &&
812 test_cmp expect actual &&
813 echo "$submodurl/repo" >expect &&
814 git config submodule.repo.url >actual &&
815 test_cmp expect actual &&
816 echo "$submodurl/bare.git" >expect &&
817 git config submodule.repo_new.url >actual &&
818 test_cmp expect actual
822 test_expect_success 'submodule add with an existing name fails unless forced' '
827 test_must_fail git submodule add -q --name repo_new "$submodurl/repo.git" repo &&
829 test_must_fail git config -f .gitmodules submodule.repo_new.path &&
830 test_must_fail git config -f .gitmodules submodule.repo_new.url &&
831 echo "$submodurl/bare.git" >expect &&
832 git config submodule.repo_new.url >actual &&
833 test_cmp expect actual &&
834 git submodule add -f -q --name repo_new "$submodurl/repo.git" repo &&
836 echo "repo" >expect &&
837 git config -f .gitmodules submodule.repo_new.path >actual &&
838 test_cmp expect actual&&
839 echo "$submodurl/repo.git" >expect &&
840 git config -f .gitmodules submodule.repo_new.url >actual &&
841 test_cmp expect actual &&
842 echo "$submodurl/repo.git" >expect &&
843 git config submodule.repo_new.url >actual &&
844 test_cmp expect actual
848 test_expect_success 'set up a second submodule' '
849 git submodule add ./init2 example2 &&
850 git commit -m "submodule example2 added"
853 test_expect_success 'submodule deinit should remove the whole submodule section from .git/config' '
854 git config submodule.example.foo bar &&
855 git config submodule.example2.frotz nitfol &&
856 git submodule deinit init &&
857 test -z "$(git config --get-regexp "submodule\.example\.")" &&
858 test -n "$(git config --get-regexp "submodule\.example2\.")" &&
859 test -f example2/.git &&
863 test_expect_success 'submodule deinit from subdirectory' '
864 git submodule update --init &&
865 git config submodule.example.foo bar &&
869 git submodule deinit ../init >../output
871 grep "\\.\\./init" output &&
872 test -z "$(git config --get-regexp "submodule\.example\.")" &&
873 test -n "$(git config --get-regexp "submodule\.example2\.")" &&
874 test -f example2/.git &&
878 test_expect_success 'submodule deinit . deinits all initialized submodules' '
879 git submodule update --init &&
880 git config submodule.example.foo bar &&
881 git config submodule.example2.frotz nitfol &&
882 test_must_fail git submodule deinit &&
883 git submodule deinit . >actual &&
884 test -z "$(git config --get-regexp "submodule\.example\.")" &&
885 test -z "$(git config --get-regexp "submodule\.example2\.")" &&
886 test_i18ngrep "Cleared directory .init" actual &&
887 test_i18ngrep "Cleared directory .example2" actual &&
891 test_expect_success 'submodule deinit deinits a submodule when its work tree is missing or empty' '
892 git submodule update --init &&
893 rm -rf init example2/* example2/.git &&
894 git submodule deinit init example2 >actual &&
895 test -z "$(git config --get-regexp "submodule\.example\.")" &&
896 test -z "$(git config --get-regexp "submodule\.example2\.")" &&
897 test_i18ngrep ! "Cleared directory .init" actual &&
898 test_i18ngrep "Cleared directory .example2" actual &&
902 test_expect_success 'submodule deinit fails when the submodule contains modifications unless forced' '
903 git submodule update --init &&
905 test_must_fail git submodule deinit init &&
906 test -n "$(git config --get-regexp "submodule\.example\.")" &&
907 test -f example2/.git &&
908 git submodule deinit -f init >actual &&
909 test -z "$(git config --get-regexp "submodule\.example\.")" &&
910 test_i18ngrep "Cleared directory .init" actual &&
914 test_expect_success 'submodule deinit fails when the submodule contains untracked files unless forced' '
915 git submodule update --init &&
916 echo X >>init/untracked &&
917 test_must_fail git submodule deinit init &&
918 test -n "$(git config --get-regexp "submodule\.example\.")" &&
919 test -f example2/.git &&
920 git submodule deinit -f init >actual &&
921 test -z "$(git config --get-regexp "submodule\.example\.")" &&
922 test_i18ngrep "Cleared directory .init" actual &&
926 test_expect_success 'submodule deinit fails when the submodule HEAD does not match unless forced' '
927 git submodule update --init &&
932 test_must_fail git submodule deinit init &&
933 test -n "$(git config --get-regexp "submodule\.example\.")" &&
934 test -f example2/.git &&
935 git submodule deinit -f init >actual &&
936 test -z "$(git config --get-regexp "submodule\.example\.")" &&
937 test_i18ngrep "Cleared directory .init" actual &&
941 test_expect_success 'submodule deinit is silent when used on an uninitialized submodule' '
942 git submodule update --init &&
943 git submodule deinit init >actual &&
944 test_i18ngrep "Submodule .example. (.*) unregistered for path .init" actual &&
945 test_i18ngrep "Cleared directory .init" actual &&
946 git submodule deinit init >actual &&
947 test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
948 test_i18ngrep "Cleared directory .init" actual &&
949 git submodule deinit . >actual &&
950 test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
951 test_i18ngrep "Submodule .example2. (.*) unregistered for path .example2" actual &&
952 test_i18ngrep "Cleared directory .init" actual &&
953 git submodule deinit . >actual &&
954 test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
955 test_i18ngrep ! "Submodule .example2. (.*) unregistered for path .example2" actual &&
956 test_i18ngrep "Cleared directory .init" actual &&
960 test_expect_success 'submodule deinit fails when submodule has a .git directory even when forced' '
961 git submodule update --init &&
965 cp -R ../.git/modules/example .git &&
966 GIT_WORK_TREE=. git config --unset core.worktree
968 test_must_fail git submodule deinit init &&
969 test_must_fail git submodule deinit -f init &&
971 test -n "$(git config --get-regexp "submodule\.example\.")"
974 test_expect_success 'submodule with UTF-8 name' '
975 svname=$(printf "\303\245 \303\244\303\266") &&
982 git commit -m "init sub"
984 git submodule add ./"$svname" &&
986 test -n "$(git submodule | grep "$svname")"
989 test_expect_success 'submodule add clone shallow submodule' '
995 git submodule add --depth=1 file://"$pwd"/example2 submodule &&
998 test 1 = $(git log --oneline | wc -l)