]> source.dussan.org Git - gitea.git/commitdiff
Only update merge_base in checker if not already merged (#10908)
authorzeripath <art27@cantab.net>
Wed, 1 Apr 2020 12:02:11 +0000 (13:02 +0100)
committerGitHub <noreply@github.com>
Wed, 1 Apr 2020 12:02:11 +0000 (15:02 +0300)
Fix #10766

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
services/pull/check.go
services/pull/pull.go

index c877cc84eeab80af46f3ed4a31d7747790b09482..ea91f3a8624755d685211d52a8f4f79e278b82d9 100644 (file)
@@ -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)
                }
        }
index 5c7ec91f5d27a3e4477a24e09434da24a958502d..ce5c4ff22ffc23dbf89bb74be3a4d18c4f88229f 100644 (file)
@@ -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
        }