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

Retaining env on clone_from#677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionsAUTHORS
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,5 +22,6 @@ Contributors are:
-Anson Mansfield <anson.mansfield _at_ gmail.com>
-Ken Odegard <ken.odegard _at_ gmail.com>
-Alexis Horgix Chotard
-Piotr Babij <piotr.babij _at_ gmail.com>

Portions derived from other open source works and are clearly marked.
6 changes: 5 additions & 1 deletiongit/repo/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -931,12 +931,16 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs):
if not osp.isabs(path) and git.working_dir:
path = osp.join(git._working_dir, path)

repo = cls(path, odbt=odbt)

# retain env values that were passed to _clone()
repo.git.update_environment(**git.environment())

# adjust remotes - there may be operating systems which use backslashes,
# These might be given as initial paths, but when handling the config file
# that contains the remote from which we were clones, git stops liking it
# as it will escape the backslashes. Hence we undo the escaping just to be
# sure
repo = cls(path, odbt=odbt)
if repo.remotes:
with repo.remotes[0].config_writer as writer:
writer.set_value('url', Git.polish_url(repo.remotes[0].url))
Expand Down
9 changes: 9 additions & 0 deletionsgit/test/test_repo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -201,6 +201,15 @@ def _assert_empty_repo(self, repo):
pass
# END test repos with working tree

@with_rw_directory
def test_clone_from_keeps_env(self, rw_dir):
original_repo = Repo.init(osp.join(rw_dir, "repo"))
environment = {"entry1": "value", "another_entry": "10"}

cloned = Repo.clone_from(original_repo.git_dir, osp.join(rw_dir, "clone"), env=environment)

assert_equal(environment, cloned.git.environment())

def test_init(self):
prev_cwd = os.getcwd()
os.chdir(tempfile.gettempdir())
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp