From 8b2af5f040b968dd40579be110b734b4baa822c7 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 18 Dec 2023 17:05:50 +0100 Subject: [PATCH] [GITEA] Allow release creation on commit (squash) s/SHAFullLength/FullLength/ (cherry picked from commit 9d549c0d33b6a16685db6eeff77734e5d60ae96e) --- routers/web/repo/release.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go index 9dee7c7d4f..61eeb53c37 100644 --- a/routers/web/repo/release.go +++ b/routers/web/repo/release.go @@ -391,9 +391,14 @@ func NewReleasePost(ctx *context.Context) { return } + objectFormat, err := ctx.Repo.GitRepo.GetObjectFormat() + if err != nil { + ctx.ServerError("GetCommit", err) + return + } // form.Target can be a branch name or a full commitID. if !ctx.Repo.GitRepo.IsBranchExist(form.Target) && - len(form.Target) == git.SHAFullLength && !ctx.Repo.GitRepo.IsCommitExist(form.Target) { + len(form.Target) == objectFormat.FullLength() && !ctx.Repo.GitRepo.IsCommitExist(form.Target) { ctx.RenderWithErr(ctx.Tr("form.target_branch_not_exist"), tplReleaseNew, &form) return }