Skip to content

Commit

Permalink
Only update merge_base if not already merged
Browse files Browse the repository at this point in the history
Fix go-gitea#10766

Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath committed Mar 31, 2020
1 parent 2c25e75 commit 037df3f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion services/pull/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion services/pull/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 037df3f

Please sign in to comment.