Skip to content

Commit d93aea5

Browse files
committed
Fix issue not auto-closing when it includes a reference to a branch
Ensure branch prefix is stripped away for both when comparing the branch name.
1 parent 7ddc11d commit d93aea5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: services/issue/commit.go

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

0 commit comments

Comments
 (0)