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

Commitd2ce495

Browse files
authored
Merge pull request#677 from bpiotr/retaining-env-on-clone
Retaining env on clone_from
2 parentsddb828e +55c5f73 commitd2ce495

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

‎AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ Contributors are:
2222
-Anson Mansfield <anson.mansfield _at_ gmail.com>
2323
-Ken Odegard <ken.odegard _at_ gmail.com>
2424
-Alexis Horgix Chotard
25+
-Piotr Babij <piotr.babij _at_ gmail.com>
2526

2627
Portions derived from other open source works and are clearly marked.

‎git/repo/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,12 +931,16 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs):
931931
ifnotosp.isabs(path)andgit.working_dir:
932932
path=osp.join(git._working_dir,path)
933933

934+
repo=cls(path,odbt=odbt)
935+
936+
# retain env values that were passed to _clone()
937+
repo.git.update_environment(**git.environment())
938+
934939
# adjust remotes - there may be operating systems which use backslashes,
935940
# These might be given as initial paths, but when handling the config file
936941
# that contains the remote from which we were clones, git stops liking it
937942
# as it will escape the backslashes. Hence we undo the escaping just to be
938943
# sure
939-
repo=cls(path,odbt=odbt)
940944
ifrepo.remotes:
941945
withrepo.remotes[0].config_writeraswriter:
942946
writer.set_value('url',Git.polish_url(repo.remotes[0].url))

‎git/test/test_repo.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,15 @@ def _assert_empty_repo(self, repo):
201201
pass
202202
# END test repos with working tree
203203

204+
@with_rw_directory
205+
deftest_clone_from_keeps_env(self,rw_dir):
206+
original_repo=Repo.init(osp.join(rw_dir,"repo"))
207+
environment= {"entry1":"value","another_entry":"10"}
208+
209+
cloned=Repo.clone_from(original_repo.git_dir,osp.join(rw_dir,"clone"),env=environment)
210+
211+
assert_equal(environment,cloned.git.environment())
212+
204213
deftest_init(self):
205214
prev_cwd=os.getcwd()
206215
os.chdir(tempfile.gettempdir())

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp