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,21 @@ test_expect_success 'submodule update detaching the HEAD ' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'submodule update from subdirectory' '
|
||||
(cd super/submodule &&
|
||||
git reset --hard HEAD~1
|
||||
) &&
|
||||
mkdir super/sub &&
|
||||
(cd super/sub &&
|
||||
(cd ../submodule &&
|
||||
compare_head
|
||||
) &&
|
||||
git submodule update ../submodule &&
|
||||
cd ../submodule &&
|
||||
! compare_head
|
||||
)
|
||||
'
|
||||
|
||||
apos="'";
|
||||
test_expect_success 'submodule update does not fetch already present commits' '
|
||||
(cd submodule &&
|
||||
|
Reference in New Issue
Block a user