fixed issue where not correctly adding perm for existing repo

This commit is contained in:
Brad Rydzewski 2014-08-11 23:15:38 -07:00
parent ca2a93ed9f
commit dcdb1605b0

View file

@ -129,12 +129,13 @@ func (h *LoginHandler) GetLogin(w http.ResponseWriter, r *http.Request) error {
repo.URL = remoteRepo.URL repo.URL = remoteRepo.URL
if err := h.repos.Insert(repo); err != nil { if err := h.repos.Insert(repo); err != nil {
log.Println("Error adding repo.", u.Login, remoteRepo.Name, err) // typically we see a failure because the repository already exists
// this is probably because the repository already exists. // in which case, we can retrieve the existing record to get the ID.
// we should still attempt to grant the user access, however. repo, err = h.repos.FindName(repo.Host, repo.Owner, repo.Name)
// if err != nil {
// todo(bradrydzewski) we should inspect the response to ensure log.Println("Error adding repo.", u.Login, remoteRepo.Name, err)
// the failure is caused by a primary key violation. continue
}
} }
// add user permissions // add user permissions