Skip to content

Commit

Permalink
Update CommitsAhead CommitsBehind on Pull BaseBranch Change too (#11912
Browse files Browse the repository at this point in the history
…) (#11915)

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

* CI.restart()
  • Loading branch information
6543 committed Jun 16, 2020
1 parent 6abb8d7 commit 47a5c8e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion services/pull/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 47a5c8e

Please sign in to comment.