Skip to content

Misleading reason, why merging a PR is blocked #13655

Closed
@ckittl

Description

@ckittl

Sorry, cannot answer the following information, as I'm not hosting the Gitea instance myself. AFAIK, it doesn't play a role either.

  • Git version:
  • Operating system:
  • Database
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Log gist:

Description

With #9592, blocking merging a pull request was enabled, if one reviewer requested changes on the code. However, with ef89e75 (regarding #10756) the checks got extended to also cover the case if one explicitly requested reviewer hasn't given any comments yet. I feel a bit confused about this in two ways.

Think of the following test case (cf. also the test repo):

  • Globally I require at least 1 review
  • In a specific PR I ask two people to review
  • One hasn't answered, yet. The other has approved without any change request

The information, why merging is blocked is misleading

As far as I was able to get from your code, the reason, why a pull request merge is blocked, is determined here:

gitea/routers/repo/issue.go

Lines 1435 to 1445 in 1bb5c09

if pull.ProtectedBranch != nil {
cnt := pull.ProtectedBranch.GetGrantedApprovalsCount(pull)
ctx.Data["IsBlockedByApprovals"] = !pull.ProtectedBranch.HasEnoughApprovals(pull)
ctx.Data["IsBlockedByRejection"] = pull.ProtectedBranch.MergeBlockedByRejectedReview(pull)
ctx.Data["IsBlockedByOutdatedBranch"] = pull.ProtectedBranch.MergeBlockedByOutdatedBranch(pull)
ctx.Data["GrantedApprovals"] = cnt
ctx.Data["RequireSigned"] = pull.ProtectedBranch.RequireSignedCommits
ctx.Data["ChangedProtectedFiles"] = pull.ChangedProtectedFiles
ctx.Data["IsBlockedByChangedProtectedFiles"] = len(pull.ChangedProtectedFiles) != 0
ctx.Data["ChangedProtectedFilesNum"] = len(pull.ChangedProtectedFiles)
}

However, obviously the condition is true also, if nobody requested changes, but still one of the explicitly requested reviewers didn't answer yet. This leads to the misleading prompt, that requested changes not have been addressed, yet.

My suggestion would be to spin of Branch#MergeBlockedByExplcitReviewRequest from Branch#MergeBlockedByRejectedReview and have both conditions separated.

The explicit review request override my global config

As with GitHub, I would expect, that everything is fine to be merged, as long as one reviewer has replied with approval. However, current implementation blocks the merge with no need. Despite me not finding it handy to require all requested reviews, at least it is not clear, that this is the case. Maybe a renaming of the label for review requests from "Reviewers" to "Mandatory Reviewers" would point out clearly, what it's about (cf. Screenshot).

Screenshots

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic/uiChange the appearance of the Gitea UItype/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions