fixed issue where not correctly adding perm for existing repo
This commit is contained in:
parent
ca2a93ed9f
commit
dcdb1605b0
1 changed files with 7 additions and 6 deletions
|
@ -129,12 +129,13 @@ func (h *LoginHandler) GetLogin(w http.ResponseWriter, r *http.Request) error {
|
|||
repo.URL = remoteRepo.URL
|
||||
|
||||
if err := h.repos.Insert(repo); err != nil {
|
||||
// typically we see a failure because the repository already exists
|
||||
// in which case, we can retrieve the existing record to get the ID.
|
||||
repo, err = h.repos.FindName(repo.Host, repo.Owner, repo.Name)
|
||||
if err != nil {
|
||||
log.Println("Error adding repo.", u.Login, remoteRepo.Name, err)
|
||||
// this is probably because the repository already exists.
|
||||
// we should still attempt to grant the user access, however.
|
||||
//
|
||||
// todo(bradrydzewski) we should inspect the response to ensure
|
||||
// the failure is caused by a primary key violation.
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// add user permissions
|
||||
|
|
Loading…
Reference in a new issue