diff options
author | 6543 <6543@obermui.de> | 2020-06-16 19:52:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-16 12:52:33 -0500 |
commit | 262fce6db4ab87e03926ac7a21bc5e4bea7ea815 (patch) | |
tree | ec6355f73770d19d7e24590ea5f9072b9fbad8c6 | |
parent | f399cd326ba06d74ab4235d2d14e50f6940aed69 (diff) | |
download | gitea-262fce6db4ab87e03926ac7a21bc5e4bea7ea815.tar.gz gitea-262fce6db4ab87e03926ac7a21bc5e4bea7ea815.zip |
Update CommitsAhead CommitsBehind on Pull BaseBranch Change too (#11912)
-rw-r--r-- | services/pull/pull.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/services/pull/pull.go b/services/pull/pull.go index f7a187848a..b94a46639a 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -166,7 +166,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 } |