@@ -931,7 +931,7 @@ def init(cls, path=None, mkdir=True, odbt=GitCmdObjectDB, expand_vars=True, **kw
931931 return cls (path , odbt = odbt )
932932
933933 @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 ):
935935 if progress is not None :
936936 progress = to_progress_instance (progress )
937937
@@ -953,7 +953,10 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs):
953953 sep_dir = kwargs .get ('separate_git_dir' )
954954 if sep_dir :
955955 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 ,
957960 v = True , universal_newlines = True , ** add_progress (kwargs , git , progress ))
958961 if progress :
959962 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):
983986 # END handle remote repo
984987 return repo
985988
986- def clone (self , path , progress = None , ** kwargs ):
989+ def clone (self , path , progress = None , multi_options = None , ** kwargs ):
987990 """Create a clone from this repository.
988991
989992 :param path: is the full path of the new repo (traditionally ends with ./<name>.git).
990993 :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']
991998 :param kwargs:
992999 * odbt = ObjectDatabase Type, allowing to determine the object database
9931000 implementation used by the returned Repo instance
9941001 * All remaining keyword arguments are given to the git-clone command
9951002
9961003 :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 )
9981005
9991006 @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 ):
10011008 """Create a clone from the given URL
10021009
10031010 :param url: valid git url, see http://www.kernel.org/pub/software/scm/git/docs/git-clone.html#URLS
10041011 :param to_path: Path to which the repository should be cloned to
10051012 :param progress: See 'git.remote.Remote.push'.
10061013 :param env: Optional dictionary containing the desired environment variables.
1014+ :param mutli_options: See ``clone`` method
10071015 :param kwargs: see the ``clone`` method
10081016 :return: Repo instance pointing to the cloned directory"""
10091017 git = Git (os .getcwd ())
10101018 if env is not None :
10111019 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 )
10131021
10141022 def archive (self , ostream , treeish = None , prefix = None , ** kwargs ):
10151023 """Archive the tree at the given revision.
0 commit comments