| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,5 +22,6 @@ Contributors are: | |||
| 22 | 22 | -Anson Mansfield <anson.mansfield _at_ gmail.com> | |
| 23 | 23 | -Ken Odegard <ken.odegard _at_ gmail.com> | |
| 24 | 24 | -Alexis Horgix Chotard | |
| 25 | + -Piotr Babij <piotr.babij _at_ gmail.com> | ||
| 25 | 26 | ||
| 26 | 27 | Portions derived from other open source works and are clearly marked. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -931,12 +931,16 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs): | |||
| 931 | 931 | if not osp.isabs(path) and git.working_dir: | |
| 932 | 932 | path = osp.join(git._working_dir, path) | |
| 933 | 933 | ||
| 934 | + repo = cls(path, odbt=odbt) | ||
| 935 | + | ||
| 936 | + # retain env values that were passed to _clone() | ||
| 937 | + repo.git.update_environment(**git.environment()) | ||
| 938 | + | ||
| 934 | 939 | # adjust remotes - there may be operating systems which use backslashes, | |
| 935 | 940 | # These might be given as initial paths, but when handling the config file | |
| 936 | 941 | # that contains the remote from which we were clones, git stops liking it | |
| 937 | 942 | # as it will escape the backslashes. Hence we undo the escaping just to be | |
| 938 | 943 | # sure | |
| 939 | - repo = cls(path, odbt=odbt) | ||
| 940 | 944 | if repo.remotes: | |
| 941 | 945 | with repo.remotes[0].config_writer as writer: | |
| 942 | 946 | writer.set_value('url', Git.polish_url(repo.remotes[0].url)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -201,6 +201,15 @@ def _assert_empty_repo(self, repo): | |||
| 201 | 201 | pass | |
| 202 | 202 | # END test repos with working tree | |
| 203 | 203 | ||
| 204 | + @with_rw_directory | ||
| 205 | + def test_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 | + | ||
| 204 | 213 | def test_init(self): | |
| 205 | 214 | prev_cwd = os.getcwd() | |
| 206 | 215 | os.chdir(tempfile.gettempdir()) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments