summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-04-21 21:55:45 +0000
committerGitHub <noreply@github.com>2022-04-21 22:55:45 +0100
commitebe569a268bbe71bf2bc30cd2829227700688b57 (patch)
treee4ba88d01dbaaee73135b8f61f52ae78487c0383 /modules
parent3ec1b6c2238c9eb46709091567eb2564aec86d99 (diff)
downloadgitea-ebe569a268bbe71bf2bc30cd2829227700688b57.tar.gz
gitea-ebe569a268bbe71bf2bc30cd2829227700688b57.zip
Set correct PR status on 3way on conflict checking (#19457)
* Set correct PR status on 3way on conflict checking - When 3-way merge is enabled for conflict checking, it has a new interesting behavior that it doesn't return any error when it found a conflict, so we change the condition to not check for the error, but instead check if conflictedfiles is populated, this fixes a issue whereby PR status wasn't correctly on conflicted PR's. - Refactor the mergeable property(which was incorrectly set and lead me this bug) to be more maintainable. - Add a dedicated test for conflicting checking, so it should prevent future issues with this. * Fix linter
Diffstat (limited to 'modules')
-rw-r--r--modules/convert/pull.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/modules/convert/pull.go b/modules/convert/pull.go
index 9c53afe8f3..3b39e3d2c1 100644
--- a/modules/convert/pull.go
+++ b/modules/convert/pull.go
@@ -68,6 +68,7 @@ func ToAPIPullRequest(ctx context.Context, pr *models.PullRequest, doer *user_mo
PatchURL: pr.Issue.PatchURL(),
HasMerged: pr.HasMerged,
MergeBase: pr.MergeBase,
+ Mergeable: pr.Mergeable(),
Deadline: apiIssue.Deadline,
Created: pr.Issue.CreatedUnix.AsTimePtr(),
Updated: pr.Issue.UpdatedUnix.AsTimePtr(),
@@ -191,10 +192,6 @@ func ToAPIPullRequest(ctx context.Context, pr *models.PullRequest, doer *user_mo
}
}
- if pr.Status != models.PullRequestStatusChecking {
- mergeable := !(pr.Status == models.PullRequestStatusConflict || pr.Status == models.PullRequestStatusError) && !pr.IsWorkInProgress()
- apiPullRequest.Mergeable = mergeable
- }
if pr.HasMerged {
apiPullRequest.Merged = pr.MergedUnix.AsTimePtr()
apiPullRequest.MergedCommitID = &pr.MergedCommitID