aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-03-29 17:42:34 +0100
committerGitHub <noreply@github.com>2022-03-29 18:42:34 +0200
commit1eebbf23f0a7e12d193020ba596ec61d26c33e30 (patch)
tree0113f80f8961caf134688e3babd8ec13ba7d941c /models
parent66f2210feca0b50d305a46a203c2b3d2f4d3790b (diff)
downloadgitea-1eebbf23f0a7e12d193020ba596ec61d26c33e30.tar.gz
gitea-1eebbf23f0a7e12d193020ba596ec61d26c33e30.zip
When conflicts have been previously detected ensure that they can be resolved (#19247)
There is yet another problem with conflicted files not being reset when the test patch resolves them. This PR adjusts the code for checkConflicts to reset the ConflictedFiles field immediately at the top. It also adds a reset to conflictedFiles for the manuallyMerged and a shortcut for the empty status in protectedfiles. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'models')
-rw-r--r--models/pull.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/models/pull.go b/models/pull.go
index 863c8d708f..ec1fde0259 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -424,8 +424,11 @@ func (pr *PullRequest) SetMerged() (bool, error) {
return false, fmt.Errorf("Issue.changeStatus: %v", err)
}
+ // reset the conflicted files as there cannot be any if we're merged
+ pr.ConflictedFiles = []string{}
+
// 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 {
+ if _, err := sess.Where("id = ?", pr.ID).Cols("has_merged, status, merge_base, merged_commit_id, merger_id, merged_unix, conflicted_files").Update(pr); err != nil {
return false, fmt.Errorf("Failed to update pr[%d]: %v", pr.ID, err)
}