From 408bc2c8b5de801887ccf9a9ccc2bb80e0739f2e Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 1 Apr 2020 13:02:11 +0100 Subject: [PATCH] Only update merge_base in checker if not already merged (#10908) Fix #10766 Signed-off-by: Andrew Thornton Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lauris BH --- services/pull/check.go | 2 +- services/pull/pull.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/pull/check.go b/services/pull/check.go index c877cc84e..ea91f3a86 100644 --- a/services/pull/check.go +++ b/services/pull/check.go @@ -61,7 +61,7 @@ func checkAndUpdateStatus(pr *models.PullRequest) { } if !has { - 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) } } diff --git a/services/pull/pull.go b/services/pull/pull.go index 5c7ec91f5..ce5c4ff22 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -120,7 +120,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 }