| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,5 +23,6 @@ Contributors are: | |||
| 23 | 23 | -Ken Odegard <ken.odegard _at_ gmail.com> | |
| 24 | 24 | -Alexis Horgix Chotard | |
| 25 | 25 | -Piotr Babij <piotr.babij _at_ gmail.com> | |
| 26 | + -Mikuláš Poul <mikulaspoul _at_ gmail.com> | ||
| 26 | 27 | ||
| 27 | 28 | Portions derived from other open source works and are clearly marked. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -905,6 +905,10 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs): | |||
| 905 | 905 | ||
| 906 | 906 | odbt = kwargs.pop('odbt', odb_default_type) | |
| 907 | 907 | ||
| 908 | + # when pathlib.Path or other classbased path is passed | ||
| 909 | + if not isinstance(path, str): | ||
| 910 | + path = str(path) | ||
| 911 | + | ||
| 908 | 912 | ## A bug win cygwin's Git, when `--bare` or `--separate-git-dir` | |
| 909 | 913 | # it prepends the cwd or(?) the `url` into the `path, so:: | |
| 910 | 914 | # git clone --bare /cygwin/d/foo.git C:\\Work | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,6 +16,11 @@ | |||
| 16 | 16 | except ImportError: | |
| 17 | 17 | from unittest2 import skipIf, SkipTest | |
| 18 | 18 | ||
| 19 | + try: | ||
| 20 | + import pathlib | ||
| 21 | + except ImportError: | ||
| 22 | + pathlib = None | ||
| 23 | + | ||
| 19 | 24 | from git import ( | |
| 20 | 25 | InvalidGitRepositoryError, | |
| 21 | 26 | Repo, | |
@@ -210,6 +215,15 @@ def test_clone_from_keeps_env(self, rw_dir): | |||
| 210 | 215 | ||
| 211 | 216 | assert_equal(environment, cloned.git.environment()) | |
| 212 | 217 | ||
| 218 | + @with_rw_directory | ||
| 219 | + def test_clone_from_pathlib(self, rw_dir): | ||
| 220 | + if pathlib is None: # pythons bellow 3.4 don't have pathlib | ||
| 221 | + raise SkipTest("pathlib was introduced in 3.4") | ||
| 222 | + | ||
| 223 | + original_repo = Repo.init(osp.join(rw_dir, "repo")) | ||
| 224 | + | ||
| 225 | + Repo.clone_from(original_repo.git_dir, pathlib.Path(rw_dir) / "clone_pathlib") | ||
| 226 | + | ||
| 213 | 227 | def test_init(self): | |
| 214 | 228 | prev_cwd = os.getcwd() | |
| 215 | 229 | os.chdir(tempfile.gettempdir()) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments