Skip to content

Commit

Permalink
Update CommitsAhead CommitsBehind on Pull BaseBranch Change too (go-g…
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 authored and Yohann Delafollye committed Jul 31, 2020
1 parent a591288 commit ede58eb
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 @@ -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
}

Expand Down

0 comments on commit ede58eb

Please sign in to comment.