diff options
author | Brecht Van Lommel <brecht@blender.org> | 2023-01-19 01:24:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-18 19:24:38 -0500 |
commit | cdf53fa4a7f3f7094eec8742529783ae7ceffc8f (patch) | |
tree | 2295b144e9807f39af3a3affe8882a6d7e2709e1 /services/issue | |
parent | e0a8965208f17c8f037e5489d28f1a070e2d8b47 (diff) | |
download | gitea-cdf53fa4a7f3f7094eec8742529783ae7ceffc8f.tar.gz gitea-cdf53fa4a7f3f7094eec8742529783ae7ceffc8f.zip |
Fix issue not auto-closing when it includes a reference to a branch (#22514)
Ensure branch prefix is stripped away for both when comparing the branch
name.
Diffstat (limited to 'services/issue')
-rw-r--r-- | services/issue/commit.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/services/issue/commit.go b/services/issue/commit.go index db31fc66bb..c3d2e853bb 100644 --- a/services/issue/commit.go +++ b/services/issue/commit.go @@ -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" @@ -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 |