aboutsummaryrefslogtreecommitdiffstats
path: root/models/issues/pull.go
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 /models/issues/pull.go
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 'models/issues/pull.go')
-rw-r--r--models/issues/pull.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/models/issues/pull.go b/models/issues/pull.go
index 52b9596889..f96b03445e 100644
--- a/models/issues/pull.go
+++ b/models/issues/pull.go
@@ -122,6 +122,7 @@ const (
PullRequestStatusManuallyMerged
PullRequestStatusError
PullRequestStatusEmpty
+ PullRequestStatusAncestor
)
// PullRequestFlow the flow of pull request
@@ -423,6 +424,11 @@ func (pr *PullRequest) IsEmpty() bool {
return pr.Status == PullRequestStatusEmpty
}
+// IsAncestor returns true if the Head Commit of this PR is an ancestor of the Base Commit
+func (pr *PullRequest) IsAncestor() bool {
+ return pr.Status == PullRequestStatusAncestor
+}
+
// SetMerged sets a pull request to merged and closes the corresponding issue
func (pr *PullRequest) SetMerged(ctx context.Context) (bool, error) {
if pr.HasMerged {