@@ -60,15 +60,15 @@ def make_test_git():
60
60
# URL are not allowed and using a real URL will require Internet to clone
61
61
# the repo
62
62
check_output (['git' , 'checkout' , '-b' , 'submodule' , 'master' ], env = env )
63
- add_submodule_without_cloning (
63
+ add_git_submodule_without_cloning (
64
64
directory , 'foobar' , 'https://foobar.com/git'
65
65
)
66
66
check_output (['git' , 'add' , '.' ], env = env )
67
67
check_output (['git' , 'commit' , '-m"Add submodule"' ], env = env )
68
68
69
69
# Add an invalid submodule URL in the invalidsubmodule branch
70
70
check_output (['git' , 'checkout' , '-b' , 'invalidsubmodule' , 'master' ], env = env )
71
- add_submodule_without_cloning (
71
+ add_git_submodule_without_cloning (
72
72
directory ,
'invalid' ,
'[email protected] :rtfd/readthedocs.org.git'
73
73
)
74
74
check_output (['git' , 'add' , '.' ], env = env )
@@ -80,12 +80,19 @@ def make_test_git():
80
80
81
81
82
82
@restoring_chdir
83
- def add_submodule_without_cloning (directory , submodule , url ):
83
+ def add_git_submodule_without_cloning (directory , submodule , url ):
84
84
"""
85
85
Add a submodule without cloning it.
86
86
87
87
We write directly to the git index, more details in:
88
88
https://stackoverflow.com/a/37378302/2187091
89
+
90
+ :param directory: The directory where the git repo is
91
+ :type directory: str
92
+ :param submodule: The name of the submodule to be created
93
+ :type submodule: str
94
+ :param url: The url where the submodule points to
95
+ :type url: str
89
96
"""
90
97
env = environ .copy ()
91
98
env ['GIT_DIR' ] = pjoin (directory , '.git' )
0 commit comments