@@ -931,7 +931,7 @@ def init(cls, path=None, mkdir=True, odbt=GitCmdObjectDB, expand_vars=True, **kw
931
931
return cls (path , odbt = odbt )
932
932
933
933
@classmethod
934
- def _clone (cls , git , url , path , odb_default_type , progress , ** kwargs ):
934
+ def _clone (cls , git , url , path , odb_default_type , progress , multi_options = None , ** kwargs ):
935
935
if progress is not None :
936
936
progress = to_progress_instance (progress )
937
937
@@ -953,7 +953,10 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs):
953
953
sep_dir = kwargs .get ('separate_git_dir' )
954
954
if sep_dir :
955
955
kwargs ['separate_git_dir' ] = Git .polish_url (sep_dir )
956
- proc = git .clone (Git .polish_url (url ), clone_path , with_extended_output = True , as_process = True ,
956
+ multi = None
957
+ if multi_options :
958
+ multi = ' ' .join (multi_options ).split (' ' )
959
+ proc = git .clone (multi , Git .polish_url (url ), clone_path , with_extended_output = True , as_process = True ,
957
960
v = True , universal_newlines = True , ** add_progress (kwargs , git , progress ))
958
961
if progress :
959
962
handle_process_output (proc , None , progress .new_message_handler (), finalize_process , decode_streams = False )
@@ -983,33 +986,38 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs):
983
986
# END handle remote repo
984
987
return repo
985
988
986
- def clone (self , path , progress = None , ** kwargs ):
989
+ def clone (self , path , progress = None , multi_options = None , ** kwargs ):
987
990
"""Create a clone from this repository.
988
991
989
992
:param path: is the full path of the new repo (traditionally ends with ./<name>.git).
990
993
:param progress: See 'git.remote.Remote.push'.
994
+ :param multi_options: A list of Clone options that can be provided multiple times. One
995
+ option per list item which is passed exactly as specified to clone.
996
+ For example ['--config core.filemode=false', '--config core.ignorecase',
997
+ '--recurse-submodule=repo1_path', '--recurse-submodule=repo2_path']
991
998
:param kwargs:
992
999
* odbt = ObjectDatabase Type, allowing to determine the object database
993
1000
implementation used by the returned Repo instance
994
1001
* All remaining keyword arguments are given to the git-clone command
995
1002
996
1003
:return: ``git.Repo`` (the newly cloned repo)"""
997
- return self ._clone (self .git , self .common_dir , path , type (self .odb ), progress , ** kwargs )
1004
+ return self ._clone (self .git , self .common_dir , path , type (self .odb ), progress , multi_options , ** kwargs )
998
1005
999
1006
@classmethod
1000
- def clone_from (cls , url , to_path , progress = None , env = None , ** kwargs ):
1007
+ def clone_from (cls , url , to_path , progress = None , env = None , multi_options = None , ** kwargs ):
1001
1008
"""Create a clone from the given URL
1002
1009
1003
1010
:param url: valid git url, see http://www.kernel.org/pub/software/scm/git/docs/git-clone.html#URLS
1004
1011
:param to_path: Path to which the repository should be cloned to
1005
1012
:param progress: See 'git.remote.Remote.push'.
1006
1013
:param env: Optional dictionary containing the desired environment variables.
1014
+ :param mutli_options: See ``clone`` method
1007
1015
:param kwargs: see the ``clone`` method
1008
1016
:return: Repo instance pointing to the cloned directory"""
1009
1017
git = Git (os .getcwd ())
1010
1018
if env is not None :
1011
1019
git .update_environment (** env )
1012
- return cls ._clone (git , url , to_path , GitCmdObjectDB , progress , ** kwargs )
1020
+ return cls ._clone (git , url , to_path , GitCmdObjectDB , progress , multi_options , ** kwargs )
1013
1021
1014
1022
def archive (self , ostream , treeish = None , prefix = None , ** kwargs ):
1015
1023
"""Archive the tree at the given revision.
0 commit comments