Skip to content

Fetch from a URL directly #558

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

Open
jamielennox opened this issue Dec 12, 2016 · 3 comments
Open

Fetch from a URL directly #558

jamielennox opened this issue Dec 12, 2016 · 3 comments

Comments

@jamielennox
Copy link

Something I've come across a few times trying to deal with automating multiple repositories is that the only way to fetch is with a defined remote. I want to be able to do the equivalent of git fetch git://repo.url/path/repo.git branch/name and have it return a FetchInfo I can use. Currently i'm working around this by creating a new remote, fetching from it and deleting it at the end of the operation.

Thanks.

@Byron
Copy link
Member

Byron commented Dec 12, 2016

Thanks for your feedback!

From this ticket I can only assume what you would like to see. If you flesh it out to become a feature request, chances are that someone will pick it up and implements some additional API to make that easier.

In the meanwhile, a valid workaround would be to call git directly:

r = git.Repo('path/to/clone')
r.git.fetch('git://repo.url/path/repo.git', 'branch/name')

@jamielennox
Copy link
Author

So i don't really mind what the API is, I was hoping to request the feature and then leave it up to the developers. I think the most likely is the same/similar interface (and probably code) as remote.fetch but directly on the repo. ie:

r = git.Repo('path/to/clone')`
fetch_info = r.fetch('git://repo.url/path/repo.git', 'branch/name')
print fetch_info.ref

You're right, I can use r.git.fetch and i guess FETCH_HEAD is then valid there but i thought i'd put it up as a feature request as it's something i've come across more than once now.

@Byron
Copy link
Member

Byron commented Dec 12, 2016

As GitPython is in maintenance mode, new features will have to be contributed.
Maybe someone is attracted by the help wanted label as well.

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