This PR relies on #2249. The only new commit is the last one.
4 new commits added
Pretty please pagure-ci rebuild
rebased
I'm not entirely sure I like the idea of adding more info into this JSON, it starts to be quite a bit and it may increase the IO since we would have to instantiate the pygit2 repo object even for calls not needing it.
I think I'd prefer having a dedicated API endpoint for this.
Does that make sense?
I think I would rather we query pagure.lib.git for this info rather than putting pygit2 in the model.
Thanks for taking a look. This is ready for review again.
This sounds a little odd, what would raise this? If it's pygit2 it seems odd it would raise a werkzeug exceptions.
You could consider using tests.add_commit_git_repo() as well, but that's up to you
tests.add_commit_git_repo()
Oh, could we try this on an brand new git repo?
@pingou, it's ready for review again.
That try except statement only applied when branches were returned in the to_json function. In the tests when a project in the DB existed but the git repo for that project didn't, it would throw that error. Since this is no longer needed, I removed it.
to_json
I moved the code out of models.py and put them in lib/git.py like you asked.
models.py
lib/git.py
Edit: It seems that the try except is still needed. That exception is raised when the query is run on a project without a git repo.
If we move this call in the API controller we won't have the issue with the NotFound exception
As per IRC, we will leave this as is so that a 404 is returned.
Note that this isn't w/ a new repo, create_projects() doesn't create the corresponding git repos. This is testing where there are no git repo :)
@pingou I've added the test that you asked for and removed the try except.
Note2: this isn't a situation we should encounter very often though tbh
Goody!! \ó/
Pull-Request has been merged by pingou
This PR relies on #2249. The only new commit is the last one.