path: root/t/
diff options
authorJohn Keeping <>2013-06-16 14:18:18 (GMT)
committerJunio C Hamano <>2013-06-17 20:30:01 (GMT)
commit091a6eb0feed820a43663ca63dc2bc0bb247bbae (patch)
treeb4a6a61b74de57b56288d17b3613193a616c06db /t/
parent12b9d32790b40bf3ea49134095619700191abf1f (diff)
submodule: drop the top-level requirement
Use the new rev-parse --prefix option to process all paths given to the submodule command, dropping the requirement that it be run from the top-level of the repository. Since the interpretation of a relative submodule URL depends on whether or not "remote.origin.url" is configured, explicitly block relative URLs in "git submodule add" when not at the top level of the working tree. Signed-off-by: John Keeping <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 16 insertions, 0 deletions
diff --git a/t/ b/t/
index 107b4b7..91d4fd1 100755
--- a/t/
+++ b/t/
@@ -80,6 +80,22 @@ test_expect_success 'test basic "submodule foreach" usage' '
test_i18ncmp expect actual
+cat >expect <<EOF
+Entering '../sub1'
+Entering '../sub3'
+test_expect_success 'test "submodule foreach" from subdirectory' '
+ mkdir clone/sub &&
+ (
+ cd clone/sub &&
+ git submodule foreach "echo \$toplevel-\$name-\$sm_path-\$sha1" >../../actual
+ ) &&
+ test_i18ncmp expect actual
test_expect_success 'setup nested submodules' '
git clone submodule nested1 &&
git clone submodule nested2 &&