mirror of
https://github.com/samsonjs/retrogit.git
synced 2026-03-25 09:25:49 +00:00
Handle 409 responses when trying to list commits.
This commit is contained in:
parent
0cc4188964
commit
7852b128df
1 changed files with 5 additions and 2 deletions
|
|
@ -48,7 +48,7 @@ func computeVintage(c appengine.Context, userId int, userLogin string, repoOwner
|
|||
// Cheap check to see if there are commits before the creation time.
|
||||
vintage := repo.CreatedAt.UTC()
|
||||
beforeCreationTime := repo.CreatedAt.UTC().AddDate(0, 0, -1)
|
||||
commits, _, err := githubClient.Repositories.ListCommits(
|
||||
commits, response, err := githubClient.Repositories.ListCommits(
|
||||
repoOwnerLogin,
|
||||
repoName,
|
||||
&github.CommitsListOptions{
|
||||
|
|
@ -56,7 +56,10 @@ func computeVintage(c appengine.Context, userId int, userLogin string, repoOwner
|
|||
Author: userLogin,
|
||||
Until: beforeCreationTime,
|
||||
})
|
||||
if err != nil {
|
||||
if response.StatusCode == 409 {
|
||||
// GitHub returns with a 409 when a repository is empty.
|
||||
commits = make([]github.RepositoryCommit, 0)
|
||||
} else if err != nil {
|
||||
c.Errorf("Could not load commits for repo %s: %s", *repo.FullName, err.Error())
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue