From 037df3fb357e2e1925ca1680968687699aa09495 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Tue, 31 Mar 2020 21:57:08 +0100 Subject: [PATCH] Only update merge_base if not already merged Fix #10766 Signed-off-by: Andrew Thornton --- 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 c877cc84eeab8..ea91f3a862475 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 5c7ec91f5d27a..9e4d1d9da2d53 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.UpdateCols("merge_base, status, conflicted_files, base_branch"); err != nil { return err }