@@ -851,15 +851,19 @@ def clone(self, path, progress=None, **kwargs):
851
851
return self ._clone (self .git , self .git_dir , path , type (self .odb ), progress , ** kwargs )
852
852
853
853
@classmethod
854
- def clone_from (cls , url , to_path , progress = None , ** kwargs ):
854
+ def clone_from (cls , url , to_path , progress = None , env = None , ** kwargs ):
855
855
"""Create a clone from the given URL
856
856
857
857
:param url: valid git url, see http://www.kernel.org/pub/software/scm/git/docs/git-clone.html#URLS
858
858
:param to_path: Path to which the repository should be cloned to
859
859
:param progress: See 'git.remote.Remote.push'.
860
+ :param env: Optional dictionary containing the desired environment variables.
860
861
:param kwargs: see the ``clone`` method
861
862
:return: Repo instance pointing to the cloned directory"""
862
- return cls ._clone (Git (os .getcwd ()), url , to_path , GitCmdObjectDB , progress , ** kwargs )
863
+ git = Git (os .getcwd ())
864
+ if env is not None :
865
+ git .update_environment (** env )
866
+ return cls ._clone (git , url , to_path , GitCmdObjectDB , progress , ** kwargs )
863
867
864
868
def archive (self , ostream , treeish = None , prefix = None , ** kwargs ):
865
869
"""Archive the tree at the given revision.
0 commit comments