File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -353,6 +353,11 @@ def _clone_repo(
353
353
os .makedirs (module_abspath_dir )
354
354
module_checkout_path = osp .join (str (repo .working_tree_dir ), path )
355
355
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
+
356
361
clone = git .Repo .clone_from (
357
362
url ,
358
363
module_checkout_path ,
Original file line number Diff line number Diff line change @@ -753,6 +753,22 @@ def test_add_empty_repo(self, rwdir):
753
753
)
754
754
# END for each checkout mode
755
755
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
+
756
772
@with_rw_directory
757
773
@_patch_git_config ("protocol.file.allow" , "always" )
758
774
def test_list_only_valid_submodules (self , rwdir ):
You can’t perform that action at this time.
0 commit comments