Skip to content

Commit

Permalink
Fix issue not auto-closing when it includes a reference to a branch
Browse files Browse the repository at this point in the history
Ensure branch prefix is stripped away for both when comparing the branch
name.
  • Loading branch information
brechtvl committed Jan 18, 2023
1 parent 7ddc11d commit d93aea5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion services/issue/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/references"
"code.gitea.io/gitea/modules/repository"
Expand Down Expand Up @@ -175,7 +176,8 @@ func UpdateIssuesCommit(doer *user_model.User, repo *repo_model.Repository, comm
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 refIssue.Ref != "" {
if branchName != refIssue.Ref {
issueBranchName := strings.TrimPrefix(refIssue.Ref, git.BranchPrefix)
if branchName != issueBranchName {
continue
}
// Otherwise, only process commits to the default branch
Expand Down

0 comments on commit d93aea5

Please sign in to comment.