* Dont overwrite err with nil (part #19572) Co-authored-by: Gusted <williamzijl7@hotmail.com>
This commit is contained in:
parent
755d8e21ad
commit
f7330fd027
1 changed files with 5 additions and 5 deletions
|
@ -32,8 +32,8 @@ import (
|
||||||
var prQueue queue.UniqueQueue
|
var prQueue queue.UniqueQueue
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrIsClosed = errors.New("pull is cosed")
|
ErrIsClosed = errors.New("pull is closed")
|
||||||
ErrUserNotAllowedToMerge = errors.New("user not allowed to merge")
|
ErrUserNotAllowedToMerge = models.ErrNotAllowedToMerge{}
|
||||||
ErrHasMerged = errors.New("has already been merged")
|
ErrHasMerged = errors.New("has already been merged")
|
||||||
ErrIsWorkInProgress = errors.New("work in progress PRs cannot be merged")
|
ErrIsWorkInProgress = errors.New("work in progress PRs cannot be merged")
|
||||||
ErrIsChecking = errors.New("cannot merge while conflict checking is in progress")
|
ErrIsChecking = errors.New("cannot merge while conflict checking is in progress")
|
||||||
|
@ -96,10 +96,10 @@ func CheckPullMergable(ctx context.Context, doer *user_model.User, perm *models.
|
||||||
if err := CheckPRReadyToMerge(pr, false); err != nil {
|
if err := CheckPRReadyToMerge(pr, false); err != nil {
|
||||||
if models.IsErrNotAllowedToMerge(err) {
|
if models.IsErrNotAllowedToMerge(err) {
|
||||||
if force {
|
if force {
|
||||||
if isRepoAdmin, err := models.IsUserRepoAdmin(pr.BaseRepo, doer); err != nil {
|
if isRepoAdmin, err2 := models.IsUserRepoAdmin(pr.BaseRepo, doer); err2 != nil {
|
||||||
return err
|
return err2
|
||||||
} else if !isRepoAdmin {
|
} else if !isRepoAdmin {
|
||||||
return ErrUserNotAllowedToMerge
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Reference in a new issue