threefoldtecharchive / jumpscale9_core

Apache License 2.0
0 stars 2 forks source link

git.getContentPathFromURLorPath doesn't checkout the correct branch if the repo already exists locally #169

Open serboctor opened 5 years ago

serboctor commented 5 years ago

Installation information

Detailed description

git.getContentPathFromURLorPath pulls the correct branch if it is the first time to clone a repo. However, if the repo already exists locally but uses a different branch than the one in the function call, the function will neither checkout the correct branch nor raise an error.

Steps to reproduce

Clone any repo using getContentPathFromURLorPath, then repeat the call using another branch, you'll find that the branch didn't change locally.

In [2]: j.clients.git.getContentPathFromURLorPath('https://github.com/threefoldtech/minio/tree/optimize-filemeta')
Out[2]: '/root/code/github/threefoldtech/minio/'

In [3]: !git branch
* optimize-filemeta

In [4]: j.clients.git.getContentPathFromURLorPath('https://github.com/threefoldtech/minio/tree/zerostor')
Out[4]: '/root/code/github/threefoldtech/minio/'

In [5]: !git branch
* optimize-filemeta