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 <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
12b9d32790
commit
091a6eb0fe
@ -80,6 +80,22 @@ test_expect_success 'test basic "submodule foreach" usage' '
|
||||
test_i18ncmp expect actual
|
||||
'
|
||||
|
||||
cat >expect <<EOF
|
||||
Entering '../sub1'
|
||||
$pwd/clone-foo1-../sub1-$sub1sha1
|
||||
Entering '../sub3'
|
||||
$pwd/clone-foo3-../sub3-$sub3sha1
|
||||
EOF
|
||||
|
||||
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 &&
|
||||
|
Reference in New Issue
Block a user