Browse Source

Update CommitsAhead CommitsBehind on Pull BaseBranch Change too (#11912) (#11915)

* Update CommitsAhead CommitsBehind on Pull BaseBranch Change too (#11912)

* CI.restart()
tags/v1.12.0
6543 3 years ago
parent
commit
47a5c8e1f7
No account linked to committer's email address
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      services/pull/pull.go

+ 10
- 1
services/pull/pull.go View File

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

// Update Commit Divergence
divergence, err := GetDiverging(pr)
if err != nil {
return err
}
pr.CommitsAhead = divergence.Ahead
pr.CommitsBehind = divergence.Behind

if err := pr.UpdateColsIfNotMerged("merge_base", "status", "conflicted_files", "base_branch", "commits_ahead", "commits_behind"); err != nil {
return err
}


Loading…
Cancel
Save