Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Ospite <ao2@ao2.it>2018-10-25 19:18:13 +0300
committerJunio C Hamano <gitster@pobox.com>2018-10-31 09:01:30 +0300
commit2b1257e463fe97b3f657bbf30fafdea0c4847cd7 (patch)
treefdd139c4b57085c08e74d1533364fdaf2424aaf0 /t/t7411-submodule-config.sh
parent76e9bdc437ca3111883eb57a479e5d8f582dd670 (diff)
t/helper: add test-submodule-nested-repo-config
Add a test tool to exercise config_from_gitmodules(), in particular for the case of nested submodules. Add also a test to document that reading the submoudles config of nested submodules does not work yet when the .gitmodules file is not in the working tree but it still in the index. This is because the git API does not always make it possible access the object store of an arbitrary repository (see get_oid() usage in config_from_gitmodules()). When this git limitation gets fixed the aforementioned use case will be supported too. Signed-off-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7411-submodule-config.sh')
-rwxr-xr-xt/t7411-submodule-config.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/t/t7411-submodule-config.sh b/t/t7411-submodule-config.sh
index 2cfabb18bc..89690b7adb 100755
--- a/t/t7411-submodule-config.sh
+++ b/t/t7411-submodule-config.sh
@@ -216,4 +216,38 @@ test_expect_success 'reading submodules config from the current branch when .git
)
'
+test_expect_success 'reading nested submodules config' '
+ (cd super &&
+ git init submodule/nested_submodule &&
+ echo "a" >submodule/nested_submodule/a &&
+ git -C submodule/nested_submodule add a &&
+ git -C submodule/nested_submodule commit -m "add a" &&
+ git -C submodule submodule add ./nested_submodule &&
+ git -C submodule add nested_submodule &&
+ git -C submodule commit -m "added nested_submodule" &&
+ git add submodule &&
+ git commit -m "updated submodule" &&
+ echo "./nested_submodule" >expect &&
+ test-tool submodule-nested-repo-config \
+ submodule submodule.nested_submodule.url >actual &&
+ test_cmp expect actual
+ )
+'
+
+# When this test eventually passes, before turning it into
+# test_expect_success, remember to replace the test_i18ngrep below with
+# a "test_must_be_empty warning" to be sure that the warning is actually
+# removed from the code.
+test_expect_failure 'reading nested submodules config when .gitmodules is not in the working tree' '
+ test_when_finished "git -C super/submodule checkout .gitmodules" &&
+ (cd super &&
+ echo "./nested_submodule" >expect &&
+ rm submodule/.gitmodules &&
+ test-tool submodule-nested-repo-config \
+ submodule submodule.nested_submodule.url >actual 2>warning &&
+ test_i18ngrep "nested submodules without %s in the working tree are not supported yet" warning &&
+ test_cmp expect actual
+ )
+'
+
test_done