Skip to content

Commit d7788bf

Browse files
committed
Use gogit to check if commit exists
This commit modifies the commit hash check in the render for commit messages to use gogit for better performance. Signed-off-by: Gary Kim <[email protected]>
1 parent e887f92 commit d7788bf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/markup/html.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,11 @@ func sha1CurrentPatternProcessor(ctx *postProcessCtx, node *html.Node) {
661661
// Because of this, we check to make sure that a matched hash is actually
662662
// a commit in the repository before making it a link.
663663
if ctx.metas["repoPath"] != "" {
664-
if _, err := git.NewCommand("log", "-1", hash).RunInDirBytes(ctx.metas["repoPath"]); err != nil {
664+
repo, err := git.OpenRepository(ctx.metas["repoPath"])
665+
if err != nil {
666+
return
667+
}
668+
if !repo.IsCommitExist(hash) {
665669
return
666670
}
667671
}

0 commit comments

Comments
 (0)