t7411: test lookup of uninitialized submodules
authorStefan Beller <sbeller@google.com>
Tue, 27 Dec 2016 19:36:05 +0000 (11:36 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Jan 2017 22:18:22 +0000 (14:18 -0800)
Sometimes we need to lookup information of uninitialized submodules. Make
sure that works.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7411-submodule-config.sh

index e4bb985..eea36f1 100755 (executable)
@@ -140,6 +140,27 @@ test_expect_success 'reading of local configuration' '
        )
 '
 
+cat >super/expect_url <<EOF
+Submodule url: '../submodule' for path 'b'
+Submodule url: 'git@somewhere.else.net:submodule.git' for path 'submodule'
+EOF
+
+test_expect_success 'reading of local configuration for uninitialized submodules' '
+       (
+               cd super &&
+               git submodule deinit -f b &&
+               old_submodule=$(git config submodule.submodule.url) &&
+               git config submodule.submodule.url git@somewhere.else.net:submodule.git &&
+               test-submodule-config --url \
+                       "" b \
+                       "" submodule \
+                               >actual &&
+               test_cmp expect_url actual &&
+               git config submodule.submodule.url "$old_submodule" &&
+               git submodule init b
+       )
+'
+
 cat >super/expect_fetchrecurse_die.err <<EOF
 fatal: bad submodule.submodule.fetchrecursesubmodules argument: blabla
 EOF