Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3008310

Browse files
committed
Merge pull request#307 from jonls/clone-from-with-env
Add env parameter to Repo.clone_from() for setting environment variables
2 parentsbea9077 +2c0f47b commit3008310

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎git/repo/base.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,15 +851,19 @@ def clone(self, path, progress=None, **kwargs):
851851
returnself._clone(self.git,self.git_dir,path,type(self.odb),progress,**kwargs)
852852

853853
@classmethod
854-
defclone_from(cls,url,to_path,progress=None,**kwargs):
854+
defclone_from(cls,url,to_path,progress=None,env=None,**kwargs):
855855
"""Create a clone from the given URL
856856
857857
:param url: valid git url, see http://www.kernel.org/pub/software/scm/git/docs/git-clone.html#URLS
858858
:param to_path: Path to which the repository should be cloned to
859859
:param progress: See 'git.remote.Remote.push'.
860+
:param env: Optional dictionary containing the desired environment variables.
860861
:param kwargs: see the ``clone`` method
861862
:return: Repo instance pointing to the cloned directory"""
862-
returncls._clone(Git(os.getcwd()),url,to_path,GitCmdObjectDB,progress,**kwargs)
863+
git=Git(os.getcwd())
864+
ifenvisnotNone:
865+
git.update_environment(**env)
866+
returncls._clone(git,url,to_path,GitCmdObjectDB,progress,**kwargs)
863867

864868
defarchive(self,ostream,treeish=None,prefix=None,**kwargs):
865869
"""Archive the tree at the given revision.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp