diff options
author | zeripath <art27@cantab.net> | 2021-04-10 09:27:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-10 09:27:29 +0100 |
commit | 84f5a0bc62568b6d0a67969e460f4d41339a07d6 (patch) | |
tree | 482b1254ec65ad3c1c001d4e9229c309a7ad7cf9 /models | |
parent | e375cbfd464e12a704c3c1325315a0381ab877a7 (diff) | |
download | gitea-84f5a0bc62568b6d0a67969e460f4d41339a07d6.tar.gz gitea-84f5a0bc62568b6d0a67969e460f4d41339a07d6.zip |
Always set the merge base used to merge the commit (#15352)
The issue is that the TestPatch will reset the PR MergeBase - and it is possible for TestPatch to update the MergeBase whilst a merge is ongoing. The ensuing merge will then complete but it doesn't re-set the MergeBase it used to merge the PR.
Fixes the intermittent error in git test.
Signed-off-by: Andrew Thornton art27@cantab.net
Diffstat (limited to 'models')
-rw-r--r-- | models/pull.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/models/pull.go b/models/pull.go index 47e699e192..133f196aae 100644 --- a/models/pull.go +++ b/models/pull.go @@ -406,7 +406,8 @@ func (pr *PullRequest) SetMerged() (bool, error) { return false, fmt.Errorf("Issue.changeStatus: %v", err) } - if _, err := sess.Where("id = ?", pr.ID).Cols("has_merged, status, merged_commit_id, merger_id, merged_unix").Update(pr); err != nil { + // We need to save all of the data used to compute this merge as it may have already been changed by TestPatch. FIXME: need to set some state to prevent TestPatch from running whilst we are merging. + if _, err := sess.Where("id = ?", pr.ID).Cols("has_merged, status, merge_base, merged_commit_id, merger_id, merged_unix").Update(pr); err != nil { return false, fmt.Errorf("Failed to update pr[%d]: %v", pr.ID, err) } |