[GITEA] Allow release creation on commit (squash) s/SHAFullLength/FullLength/

(cherry picked from commit 9d549c0d33)
(cherry picked from commit 8b2af5f040)
(cherry picked from commit 2262654cd7)
This commit is contained in:
Earl Warren 2023-12-18 17:05:50 +01:00
parent 251b567794
commit 5e98785109
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -391,9 +391,14 @@ func NewReleasePost(ctx *context.Context) {
return 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. // form.Target can be a branch name or a full commitID.
if !ctx.Repo.GitRepo.IsBranchExist(form.Target) && 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) ctx.RenderWithErr(ctx.Tr("form.target_branch_not_exist"), tplReleaseNew, &form)
return return
} }