From b10ee7606e14265c6116639aafccb863b77043f5 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 11 Jun 2007 21:12:21 +0200 Subject: t7400: barf if git-submodule removes or replaces a file The test for an unmolested file wouldn't fail properly if the file had been removed or replaced by something other than a regular file. This fixes it. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 3940433b8..74fafceb7 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -72,7 +72,7 @@ test_expect_success 'update should fail when path is used by a file' ' then echo "[OOPS] update should have failed" false - elif test -f lib && test "$(cat lib)" != "hello" + elif test "$(cat lib)" != "hello" then echo "[OOPS] update failed but lib file was molested" false -- cgit v1.2.1 From d57dd255a696cb68c880110a990085c08343f618 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 11 Jun 2007 21:12:23 +0200 Subject: Rename sections from "module" to "submodule" in .gitmodules Rename [module] to [submodule], so that it would be more forward compatible with the proposed extension by harmonizing the section names used in .gitmodules and .git/config. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 74fafceb7..9f2d4f9b3 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -40,7 +40,7 @@ test_expect_success 'Prepare submodule testing' ' git-add a lib z && git-commit -m "super commit 1" && mv lib .subrepo && - GIT_CONFIG=.gitmodules git-config module.lib.url git://example.com/lib.git + GIT_CONFIG=.gitmodules git-config submodule.lib.url git://example.com/lib.git ' test_expect_success 'status should only print one line' ' -- cgit v1.2.1 From 941987a554812b982094e09c5c817f18be953365 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 11 Jun 2007 21:12:24 +0200 Subject: git-submodule: give submodules proper names This changes the way git-submodule uses .gitmodules: Subsections no longer specify the submodule path, they now specify the submodule name. The submodule path is found under the new key "submodule..path", which is a required key. With this change a submodule can be moved between different 'checkout paths' without upsetting git-submodule. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 9f2d4f9b3..7a9b505b1 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -18,7 +18,7 @@ subcommands of git-submodule. # -add directory lib to 'superproject', this creates a DIRLINK entry # -add a couple of regular files to enable testing of submodule filtering # -mv lib subrepo -# -add an entry to .gitmodules for path 'lib' +# -add an entry to .gitmodules for submodule 'example' # test_expect_success 'Prepare submodule testing' ' mkdir lib && @@ -40,7 +40,19 @@ test_expect_success 'Prepare submodule testing' ' git-add a lib z && git-commit -m "super commit 1" && mv lib .subrepo && - GIT_CONFIG=.gitmodules git-config submodule.lib.url git://example.com/lib.git + GIT_CONFIG=.gitmodules git-config submodule.example.url git://example.com/lib.git +' + +test_expect_success 'status should fail for unmapped paths' ' + if git-submodule status + then + echo "[OOPS] submodule status succeeded" + false + elif ! GIT_CONFIG=.gitmodules git-config submodule.example.path lib + then + echo "[OOPS] git-config failed to update .gitmodules" + false + fi ' test_expect_success 'status should only print one line' ' @@ -54,12 +66,12 @@ test_expect_success 'status should initially be "missing"' ' test_expect_success 'init should register submodule url in .git/config' ' git-submodule init && - url=$(git-config submodule.lib.url) && + url=$(git-config submodule.example.url) && if test "$url" != "git://example.com/lib.git" then echo "[OOPS] init succeeded but submodule url is wrong" false - elif ! git-config submodule.lib.url ./.subrepo + elif ! git-config submodule.example.url ./.subrepo then echo "[OOPS] init succeeded but update of url failed" false -- cgit v1.2.1