[PATCH 5/6] t7400: Add short "git submodule add" testsuite

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Petr Baudis
Date: Friday, September 12, 2008 - 2:09 pm

This patch introduces basic tests for

	git submodule add

covering the basic functionality and the -b parameter.

A trivial update --init test fix freeloads on this commit as well.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

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

diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index be73f7b..8a002bc 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -200,7 +200,7 @@ test_expect_success 'update --init' '
 
 	mv init init2 &&
 	git config -f .gitmodules submodule.example.url "$(pwd)/init2" &&
-	git config --remove-section submodule.example
+	git config --remove-section submodule.example &&
 	git submodule update init > update.out &&
 	grep "not initialized" update.out &&
 	test ! -d init/.git &&
@@ -209,4 +209,30 @@ test_expect_success 'update --init' '
 
 '
 
+test_expect_success 'submodule add' '
+
+	git submodule add "$(pwd)/init2" init-added &&
+	test -d init-added/.git &&
+	[ "$(git config -f .gitmodules submodule.init-added.url)" = "$(pwd)/init2" ] &&
+	[ "$(git config -f .gitmodules submodule.init-added.path)" = "init-added" ]
+
+'
+
+test_expect_success 'submodule add -b' '
+
+	(
+		cd init2 &&
+		git checkout -b branch &&
+		echo t >s &&
+		git add s &&
+		git commit -m "change branch" &&
+		git checkout master
+	) &&
+	git submodule add -b branch -- "$(pwd)/init2" init-added-b &&
+	test -d init-added-b/.git &&
+	[ "$(git config -f .gitmodules submodule.init-added-b.url)" = "$(pwd)/init2" ] &&
+	[ "$(cd init2 && git rev-parse branch)" = "$(cd init-added-b && git rev-parse HEAD)" ]
+
+'
+
 test_done

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/6] Submodule support for git mv and git rm, Petr Baudis, (Fri Sep 12, 2:08 pm)
[PATCH 2/6] git rm: Support for removing submodules, Petr Baudis, (Fri Sep 12, 2:09 pm)
[PATCH 3/6] git mv: Support moving submodules, Petr Baudis, (Fri Sep 12, 2:09 pm)
[PATCH 4/6] t7403: Submodule git mv, git rm testsuite, Petr Baudis, (Fri Sep 12, 2:09 pm)
[PATCH 5/6] t7400: Add short "git submodule add" testsuite, Petr Baudis, (Fri Sep 12, 2:09 pm)
[PATCH] git mv: Support moving submodules, Petr Baudis, (Fri Sep 12, 2:42 pm)
Re: [PATCH 2/6] git rm: Support for removing submodules, Junio C Hamano, (Fri Sep 12, 2:49 pm)
Re: [PATCH 2/6] git rm: Support for removing submodules, Junio C Hamano, (Fri Sep 12, 2:59 pm)
Re: [PATCH] git mv: Support moving submodules, Junio C Hamano, (Fri Sep 12, 3:19 pm)
Re: [PATCH 2/6] git rm: Support for removing submodules, Junio C Hamano, (Fri Sep 12, 3:42 pm)