Fix issue not auto-closing when it includes a reference to a branch (#22514) (#22521)

Backport #22514

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
tokarchuk/v1.18
John Olheiser 2 years ago committed by GitHub
parent fa33271157
commit fd7ebaaa9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      services/issue/commit.go

@ -19,6 +19,7 @@ import (
repo_model "code.gitea.io/gitea/models/repo" repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user" user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/container" "code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/references" "code.gitea.io/gitea/modules/references"
"code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/repository"
@ -176,7 +177,8 @@ func UpdateIssuesCommit(doer *user_model.User, repo *repo_model.Repository, comm
if !repo.CloseIssuesViaCommitInAnyBranch { if !repo.CloseIssuesViaCommitInAnyBranch {
// If the issue was specified to be in a particular branch, don't allow commits in other branches to close it // If the issue was specified to be in a particular branch, don't allow commits in other branches to close it
if refIssue.Ref != "" { if refIssue.Ref != "" {
if branchName != refIssue.Ref { issueBranchName := strings.TrimPrefix(refIssue.Ref, git.BranchPrefix)
if branchName != issueBranchName {
continue continue
} }
// Otherwise, only process commits to the default branch // Otherwise, only process commits to the default branch

Loading…
Cancel
Save