Only update merge_base if not already merged (#10909)

* Only update merge_base if not already merged

Fix #10766

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Prevent race in transfer pull request

* Update services/pull/pull.go
This commit is contained in:
zeripath 2020-04-01 13:33:44 +01:00 committed by GitHub
parent 139fc7cfee
commit bfce841b04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ func checkAndUpdateStatus(pr *models.PullRequest) {
// Make sure there is no waiting test to process before leaving the checking status.
if !pullRequestQueue.Exist(pr.ID) {
if err := pr.UpdateCols("merge_base", "status", "conflicted_files"); err != nil {
if err := pr.UpdateColsIfNotMerged("merge_base", "status", "conflicted_files"); err != nil {
log.Error("Update[%d]: %v", pr.ID, err)
}
}

View File

@ -115,7 +115,7 @@ func ChangeTargetBranch(pr *models.PullRequest, doer *models.User, targetBranch
if pr.Status == models.PullRequestStatusChecking {
pr.Status = models.PullRequestStatusMergeable
}
if err := pr.UpdateCols("status, conflicted_files, base_branch"); err != nil {
if err := pr.UpdateColsIfNotMerged("merge_base", "status", "conflicted_files", "base_branch"); err != nil {
return err
}