File tree Expand file tree Collapse file tree
Open diff view settings
Expand file tree Collapse file tree
Open diff view settings
Original file line number Diff line number Diff line change @@ -353,6 +353,11 @@ def _clone_repo(
353353 os .makedirs (module_abspath_dir )
354354 module_checkout_path = osp .join (str (repo .working_tree_dir ), path )
355355
356+ if url .startswith ('../' ):
357+ remote_name = repo .active_branch .tracking_branch ().remote_name
358+ repo_remote_url = repo .remote (remote_name ).url
359+ url = os .path .join (repo_remote_url , url )
360+
356361 clone = git .Repo .clone_from (
357362 url ,
358363 module_checkout_path ,
Original file line number Diff line number Diff line change @@ -753,6 +753,22 @@ def test_add_empty_repo(self, rwdir):
753753 )
754754 # END for each checkout mode
755755
756+ @with_rw_directory
757+ @_patch_git_config ("protocol.file.allow" , "always" )
758+ def test_update_submodule_with_relative_path (self , rwdir ):
759+ repo_path = osp .join (rwdir , "parent" )
760+ repo = git .Repo .init (repo_path )
761+ module_repo_path = osp .join (rwdir , "module" )
762+ module_repo = git .Repo .init (module_repo_path )
763+ module_repo .git .commit (m = "test" , allow_empty = True )
764+ repo .git .submodule ("add" , "../module" , "module" )
765+ repo .index .commit ("add submodule" )
766+
767+ cloned_repo_path = osp .join (rwdir , "cloned_repo" )
768+ cloned_repo = git .Repo .clone_from (repo_path , cloned_repo_path )
769+
770+ cloned_repo .submodule_update (init = True , recursive = True )
771+
756772 @with_rw_directory
757773 @_patch_git_config ("protocol.file.allow" , "always" )
758774 def test_list_only_valid_submodules (self , rwdir ):
You can’t perform that action at this time.
0 commit comments