{{if and .Issue.PullRequest.HasMerged (not .IsPullBranchDeletable)}}
{{/* Then the merge box will not be displayed because this page already contains enough information */}}
{{else}}
{{end}}
{{$notAllOverridableChecksOk := or .IsBlockedByApprovals .IsBlockedByRejection .IsBlockedByOfficialReviewRequests .IsBlockedByOutdatedBranch .IsBlockedByChangedProtectedFiles (and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess))}}
{{/* admin can merge without checks, writer can merge when checks succeed */}}
{{$canMergeNow := and (or (and $.IsRepoAdmin (not .ProtectedBranch.ApplyToAdmins)) (not $notAllOverridableChecksOk)) (or (not .AllowMerge) (not .RequireSigned) .WillSign)}}
{{/* admin and writer both can make an auto merge schedule */}}
{{if $canMergeNow}}
{{if $notAllOverridableChecksOk}}
{{end}} {{/* end if user is allowed to merge or not */}}
{{else}}
{{/* Merge conflict without specific file. Suggest manual merge, only if all reviews and status checks OK. */}}
{{if .IsBlockedByApprovals}}
{{end}}
{{end}}{{/* end if: pull request status */}}
{{/*
Manually Merged is not a well-known feature, it is used to mark a non-mergeable PR (already merged, conflicted) as merged
To test it:
* Enable "Manually Merged" feature in the Repository Settings
* Create a pull request, either:
* - Merge the pull request branch locally and push the merged commit to Gitea
* - Make some conflicts between the base branch and the pull request branch
* Then the Manually Merged form will be shown in the merge form
*/}}
{{if and $.StillCanManualMerge (not $showGeneralMergeForm)}}
{{ctx.Locale.Tr "repo.pulls.merged_success"}}
%s
" .HeadTarget)}}{{ctx.Locale.Tr "repo.pulls.closed"}}
{{range .ConflictedFiles}}- {{.}}
{{end}}
{{else if .IsPullRequestBroken}}{{range .ChangedProtectedFiles}}- {{.}}
{{end}}
{{else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsError .RequiredStatusCheckState.IsFailure)}}{{range .ChangedProtectedFiles}}- {{.}}
{{end}}
{{else if and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess)}}