From 196593e2e996aa4a59547629b870701f2b001d9b Mon Sep 17 00:00:00 2001 From: zeripath Date: Sun, 20 Jun 2021 23:39:12 +0100 Subject: More efficiently parse shas for shaPostProcessor (#16101) * More efficiently parse shas for shaPostProcessor The shaPostProcessor currently repeatedly calls git rev-parse --verify on both backends which is fine if there is only one thing that matches a sha - however if there are multiple things then this becomes wildly inefficient. This PR provides functions for both backends which are much faster to use. Fix #16092 * Add ShaExistCache to RenderContext Signed-off-by: Andrew Thornton Co-authored-by: 6543 <6543@obermui.de> --- routers/web/repo/projects.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'routers/web/repo/projects.go') diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go index eb0719995c..c7490893d5 100644 --- a/routers/web/repo/projects.go +++ b/routers/web/repo/projects.go @@ -81,6 +81,7 @@ func Projects(ctx *context.Context) { projects[i].RenderedContent, err = markdown.RenderString(&markup.RenderContext{ URLPrefix: ctx.Repo.RepoLink, Metas: ctx.Repo.Repository.ComposeMetas(), + GitRepo: ctx.Repo.GitRepo, }, projects[i].Description) if err != nil { ctx.ServerError("RenderString", err) @@ -322,6 +323,7 @@ func ViewProject(ctx *context.Context) { project.RenderedContent, err = markdown.RenderString(&markup.RenderContext{ URLPrefix: ctx.Repo.RepoLink, Metas: ctx.Repo.Repository.ComposeMetas(), + GitRepo: ctx.Repo.GitRepo, }, project.Description) if err != nil { ctx.ServerError("RenderString", err) -- cgit v1.2.3