summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorIng. Jaroslav Šafka <devel@safka.org>2022-07-13 10:22:51 +0200
committerGitHub <noreply@github.com>2022-07-13 16:22:51 +0800
commit8420c1bf4c46a59973d30af5114216918d0f60cd (patch)
treeecbc9df280a2be760f6d37853d78c62997af5fe0 /templates
parentb7c6ec91bac5ab0a5382f99a72753574dbc41745 (diff)
downloadgitea-8420c1bf4c46a59973d30af5114216918d0f60cd.tar.gz
gitea-8420c1bf4c46a59973d30af5114216918d0f60cd.zip
Fix checks in PR for empty commits #19603 (#20290)
* Fixes issue #19603 (Not able to merge commit in PR when branches content is same, but different commit id) * fill HeadCommitID in PullRequest * compare real commits ID as check for merging * based on @zeripath patch in #19738
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/issue/view_content/pull.tmpl16
1 files changed, 12 insertions, 4 deletions
diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl
index 179f857ba6..60fe667a54 100644
--- a/templates/repo/issue/view_content/pull.tmpl
+++ b/templates/repo/issue/view_content/pull.tmpl
@@ -195,12 +195,12 @@
<i class="icon icon-octicon">{{svg "octicon-sync"}}</i>
{{$.locale.Tr "repo.pulls.is_checking"}}
</div>
- {{else if .Issue.PullRequest.IsEmpty}}
+ {{else if .Issue.PullRequest.IsAncestor}}
<div class="item">
<i class="icon icon-octicon">{{svg "octicon-alert" 16}}</i>
- {{$.locale.Tr "repo.pulls.is_empty"}}
+ {{$.locale.Tr "repo.pulls.is_ancestor"}}
</div>
- {{else if .Issue.PullRequest.CanAutoMerge}}
+ {{else if or .Issue.PullRequest.CanAutoMerge .Issue.PullRequest.IsEmpty}}
{{if .IsBlockedByApprovals}}
<div class="item">
<i class="icon icon-octicon">{{svg "octicon-x"}}</i>
@@ -282,7 +282,6 @@
</div>
{{end}}
{{end}}
-
{{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}}
<div class="ui divider"></div>
<div class="item item-section">
@@ -321,6 +320,14 @@
</div>
</div>
{{end}}
+ {{if .Issue.PullRequest.IsEmpty}}
+ <div class="ui divider"></div>
+
+ <div class="item">
+ <i class="icon icon-octicon">{{svg "octicon-alert" 16}}</i>
+ {{$.locale.Tr "repo.pulls.is_empty"}}
+ </div>
+ {{end}}
{{if .AllowMerge}} {{/* user is allowed to merge */}}
{{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}}
@@ -348,6 +355,7 @@
'canMergeNow': {{$canMergeNow}},
'allOverridableChecksOk': {{not $notAllOverridableChecksOk}},
+ 'emptyCommit': {{.Issue.PullRequest.IsEmpty}},
'pullHeadCommitID': {{.PullHeadCommitID}},
'isPullBranchDeletable': {{.IsPullBranchDeletable}},
'defaultDeleteBranchAfterMerge': {{$prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge}},