Skip to content

Commit fd7ebaa

Browse files
jolheiserbrechtvl
andauthored
Fix issue not auto-closing when it includes a reference to a branch (#22514) (#22521)
Backport #22514 Co-authored-by: Brecht Van Lommel <[email protected]>
1 parent fa33271 commit fd7ebaa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

services/issue/commit.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
repo_model "code.gitea.io/gitea/models/repo"
2020
user_model "code.gitea.io/gitea/models/user"
2121
"code.gitea.io/gitea/modules/container"
22+
"code.gitea.io/gitea/modules/git"
2223
"code.gitea.io/gitea/modules/log"
2324
"code.gitea.io/gitea/modules/references"
2425
"code.gitea.io/gitea/modules/repository"
@@ -176,7 +177,8 @@ func UpdateIssuesCommit(doer *user_model.User, repo *repo_model.Repository, comm
176177
if !repo.CloseIssuesViaCommitInAnyBranch {
177178
// If the issue was specified to be in a particular branch, don't allow commits in other branches to close it
178179
if refIssue.Ref != "" {
179-
if branchName != refIssue.Ref {
180+
issueBranchName := strings.TrimPrefix(refIssue.Ref, git.BranchPrefix)
181+
if branchName != issueBranchName {
180182
continue
181183
}
182184
// Otherwise, only process commits to the default branch

0 commit comments

Comments
 (0)