Compare commits

...

3 Commits

Author SHA1 Message Date
Earl Warren 1bb403421d
[SEMVER] 6.0.12+0-gitea-1.21.11 2024-04-19 11:41:35 +02:00
Earl Warren f702129854 Merge pull request 'fix(api): error 500 on tag creation when a workflow exists' (#3324) from earl-warren/forgejo:wip-v1.21-tag-api-regression into v1.21/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3324
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-04-19 09:38:18 +00:00
Earl Warren a53194f4b1
fix(api): error 500 on tag creation when a workflow exists
files_service.CreateCommitStatus must not explicitly call
gitRepo.Close(), it will be called by the closer function.

Calling it explicitly will cause the repository to be closed
prematurely when obtained from the context, making it unusuable by the
caller later on.

For instance, as CreateCommitStatus is called indirectly when a
workflow exists for the tag to be created, it will make the repositoryn
in the context unusable for the tag creation API.
2024-04-19 10:52:17 +02:00
2 changed files with 1 additions and 3 deletions

View File

@ -89,7 +89,7 @@ endif
VERSION = ${GITEA_VERSION}
# SemVer
FORGEJO_VERSION := 6.0.11+0-gitea-1.21.11
FORGEJO_VERSION := 6.0.12+0-gitea-1.21.11
LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)" -X "code.gitea.io/gitea/routers/api/forgejo/v1.ForgejoVersion=$(FORGEJO_VERSION)" -X "main.ForgejoVersion=$(FORGEJO_VERSION)"

View File

@ -30,13 +30,11 @@ func CreateCommitStatus(ctx context.Context, repo *repo_model.Repository, creato
defer closer.Close()
if commit, err := gitRepo.GetCommit(sha); err != nil {
gitRepo.Close()
return fmt.Errorf("GetCommit[%s]: %w", sha, err)
} else if len(sha) != git.SHAFullLength {
// use complete commit sha
sha = commit.ID.String()
}
gitRepo.Close()
if err := git_model.NewCommitStatus(ctx, git_model.NewCommitStatusOptions{
Repo: repo,