Merge branch 'pw/rebase-i-regression-fix'
[gitweb.git] / t / t7411-submodule-config.sh
index fc97c3314e2d89e11b4a846457f5e183f4fc42c0..eea36f1dbe37859c5b45ca18bb3c8f1080ff3f9a 100755 (executable)
@@ -82,6 +82,31 @@ test_expect_success 'error in one submodule config lets continue' '
        )
 '
 
+test_expect_success 'error message contains blob reference' '
+       (cd super &&
+               sha1=$(git rev-parse HEAD) &&
+               test-submodule-config \
+                       HEAD b \
+                       HEAD submodule \
+                               2>actual_err &&
+               test_i18ngrep "submodule-blob $sha1:.gitmodules" actual_err >/dev/null
+       )
+'
+
+test_expect_success 'using different treeishs works' '
+       (
+               cd super &&
+               git tag new_tag &&
+               tree=$(git rev-parse HEAD^{tree}) &&
+               commit=$(git rev-parse HEAD^{commit}) &&
+               test-submodule-config $commit b >expect &&
+               test-submodule-config $tree b >actual.1 &&
+               test-submodule-config new_tag b >actual.2 &&
+               test_cmp expect actual.1 &&
+               test_cmp expect actual.2
+       )
+'
+
 cat >super/expect_url <<EOF
 Submodule url: 'git@somewhere.else.net:a.git' for path 'b'
 Submodule url: 'git@somewhere.else.net:submodule.git' for path 'submodule'
@@ -109,12 +134,33 @@ test_expect_success 'reading of local configuration' '
                        "" submodule \
                                >actual &&
                test_cmp expect_local_path actual &&
-               git config submodule.a.url $old_a &&
-               git config submodule.submodule.url $old_submodule &&
+               git config submodule.a.url "$old_a" &&
+               git config submodule.submodule.url "$old_submodule" &&
                git config --unset submodule.a.path c
        )
 '
 
+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