aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-06-16 21:56:47 +0200
committerGitHub <noreply@github.com>2020-06-16 15:56:47 -0400
commit47a5c8e1f79fb12baaa8d7af3e99b6ad3523099e (patch)
tree94d49074c01f4cf58f352e80a30b6a8e75b7089c
parent6abb8d751ccaa16d2bc8aff9940faf93ee775b17 (diff)
downloadgitea-47a5c8e1f79fb12baaa8d7af3e99b6ad3523099e.tar.gz
gitea-47a5c8e1f79fb12baaa8d7af3e99b6ad3523099e.zip
Update CommitsAhead CommitsBehind on Pull BaseBranch Change too (#11912) (#11915)
* Update CommitsAhead CommitsBehind on Pull BaseBranch Change too (#11912) * CI.restart()
-rw-r--r--services/pull/pull.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/services/pull/pull.go b/services/pull/pull.go
index aeb0c009f9..373962a2d9 100644
--- a/services/pull/pull.go
+++ b/services/pull/pull.go
@@ -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
}