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
@ -45,6 +45,42 @@ EOF
|
||||
test_cmp expected actual
|
||||
"
|
||||
|
||||
test_expect_success 'added submodule (subdirectory)' "
|
||||
mkdir sub &&
|
||||
(
|
||||
cd sub &&
|
||||
git submodule summary >../actual
|
||||
) &&
|
||||
cat >expected <<-EOF &&
|
||||
* ../sm1 0000000...$head1 (2):
|
||||
> Add foo2
|
||||
|
||||
EOF
|
||||
test_cmp expected actual
|
||||
"
|
||||
|
||||
test_expect_success 'added submodule (subdirectory only)' "
|
||||
(
|
||||
cd sub &&
|
||||
git submodule summary . >../actual
|
||||
) &&
|
||||
>expected &&
|
||||
test_cmp expected actual
|
||||
"
|
||||
|
||||
test_expect_success 'added submodule (subdirectory with explicit path)' "
|
||||
(
|
||||
cd sub &&
|
||||
git submodule summary ../sm1 >../actual
|
||||
) &&
|
||||
cat >expected <<-EOF &&
|
||||
* ../sm1 0000000...$head1 (2):
|
||||
> Add foo2
|
||||
|
||||
EOF
|
||||
test_cmp expected actual
|
||||
"
|
||||
|
||||
commit_file sm1 &&
|
||||
head2=$(add_file sm1 foo3)
|
||||
|
||||
|
Reference in New Issue
Block a user