Skip to content

Cloning to Path from pathlib no longer work #684

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mikicz opened this issue Oct 5, 2017 · 2 comments
Closed

Cloning to Path from pathlib no longer work #684

mikicz opened this issue Oct 5, 2017 · 2 comments

Comments

@mikicz
Copy link
Contributor

mikicz commented Oct 5, 2017

Since version 2.1.7 using Path from pathlib to declare path in Repo.clone_from doesn't work anymore - it was working fine on 2.1.6 and before.

How to reproduce:

pip install gitpython==2.1.7

Run

from pathlib import Path
from git import Repo

path = Path("test1").resolve()
repo = Repo.clone_from("https://github.com/gitpython-developers/async.git", path)

On 2.1.7 it raises TypeError

Traceback (most recent call last):
  File "script.py", line 6, in <module>
    repo = Repo.clone_from("https://github.com/gitpython-developers/async.git", path)
  File "/home/miki/.pyenv/versions/test_gitpython/lib/python3.6/site-packages/git/repo/base.py", line 972, in clone_from
    return cls._clone(git, url, to_path, GitCmdObjectDB, progress, **kwargs)
  File "/home/miki/.pyenv/versions/test_gitpython/lib/python3.6/site-packages/git/repo/base.py", line 939, in _clone
    repo = cls(path, odbt=odbt)
  File "/home/miki/.pyenv/versions/test_gitpython/lib/python3.6/site-packages/git/repo/base.py", line 125, in __init__
    if expand_vars and ("%" in epath or "$" in epath):
TypeError: argument of type 'PosixPath' is not iterable

I am running this on python 3.6.2.

@Byron
Copy link
Member

Byron commented Oct 7, 2017

Thanks a lot for taking the time to flesh out the issue in such great detail!

Apparently the function assumes path to be a string, and fails otherwise. Probably this could be fixed by converting it to a string in the respective portion of the path, which could be an easy contribution to make.

@mikicz
Copy link
Contributor Author

mikicz commented Oct 7, 2017

Sure, I'll open a PR today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants