[PATCHv2 1/4] git submodule: Add test cases for git submodule add

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add two simple test cases for adding and initialising submodules. The
init step is necessary in order to verify the added information.

The second test exposes a known breakage due to './' in the path: git
ls-files simplifies the path but git add does not, which leads to git
init looking for different lines in .gitmodules than git add adds.

Signed-off-by: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx>
---
Note: Tests for add and init are somewhat interdependent in the sense
that you need either in order to test success for the other. I put the
add tests first because you need to add a submodule before you can init
it.

 t/t7400-submodule-basic.sh |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index b8cb2df..b154050 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -47,6 +47,25 @@ test_expect_success 'Prepare submodule testing' '
 	GIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git
 '
 
+test_expect_success 'Prepare submodule add testing' '
+	submodurl=$(pwd)
+	mkdir addtest &&
+	pushd addtest &&
+	git init
+'
+
+test_expect_success 'submodule add' '
+	git submodule add "$submodurl" submod &&
+	git submodule init
+'
+
+test_expect_failure 'submodule add with ./ in path' '
+	git submodule add "$submodurl" ././dotsubmod/./frotz/./ &&
+	git submodule init
+'
+# end of submodule add testing
+popd >/dev/null
+
 test_expect_success 'status should fail for unmapped paths' '
 	if git submodule status
 	then
-- 
1.6.2.rc1.30.gd43c

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux