pygit2
pygit2 copied to clipboard
Abillity to clone git repository in non-empty folder [feature-request]
When I try to clone a repository using the pygit2.clone_repository function, it keeps giving me a '.' exists and is not an empty directory error. I can solve this by appending a backward slash / to the pathstr. I, however, for my project, need to be able to clone multiple repositories next to each other inside a catkin workspace. There are several easy workarounds for this problem, but I wondered if this is supported out of the box. I think supporting this out of the box would be more in line with how the bash git client clones git repositories.
How to reproduce
- Run the following code in python.
import pygit2
repo_url = "https://bitbucket.org/theconstructcore/spawn_robot_tools.git"
pygit2.clone_repository(repo_url, ".", bare=True)
- See the not empty folder error.
Example work-around
import pygit2
repo_url = "https://bitbucket.org/theconstructcore/spawn_robot_tools.git"
pygit2.clone_repository(repo_url, "./"+repo_url.split("/")[-1].replace(".git", ""), bare=True)