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

Converting path in _clone to str before any other operation#685

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
Byron merged 1 commit intogitpython-developers:masterfrommikicz:pathlib-clone
Nov 2, 2017
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@@ -23,5 +23,6 @@ Contributors are:
-Ken Odegard <ken.odegard _at_ gmail.com>
-Alexis Horgix Chotard
-Piotr Babij <piotr.babij _at_ gmail.com>
-Mikuláš Poul <mikulaspoul _at_ gmail.com>

Portions derived from other open source works and are clearly marked.
4 changes: 4 additions & 0 deletionsgit/repo/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -905,6 +905,10 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs):

odbt = kwargs.pop('odbt', odb_default_type)

# when pathlib.Path or other classbased path is passed
if not isinstance(path, str):
path = str(path)

## A bug win cygwin's Git, when `--bare` or `--separate-git-dir`
# it prepends the cwd or(?) the `url` into the `path, so::
# git clone --bare /cygwin/d/foo.git C:\\Work
Expand Down
14 changes: 14 additions & 0 deletionsgit/test/test_repo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,6 +16,11 @@
except ImportError:
from unittest2 import skipIf, SkipTest

try:
import pathlib
except ImportError:
pathlib = None

from git import (
InvalidGitRepositoryError,
Repo,
Expand DownExpand Up@@ -210,6 +215,15 @@ def test_clone_from_keeps_env(self, rw_dir):

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

@with_rw_directory
def test_clone_from_pathlib(self, rw_dir):
if pathlib is None: # pythons bellow 3.4 don't have pathlib
raise SkipTest("pathlib was introduced in 3.4")

original_repo = Repo.init(osp.join(rw_dir, "repo"))

Repo.clone_from(original_repo.git_dir, pathlib.Path(rw_dir) / "clone_pathlib")

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

[8]ページ先頭

©2009-2025 Movatter.jp