mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 08:02:36 +09:00 
			
		
		
		
	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 <gary@garykim.dev>
This commit is contained in:
		@@ -661,7 +661,11 @@ func sha1CurrentPatternProcessor(ctx *postProcessCtx, node *html.Node) {
 | 
				
			|||||||
	// Because of this, we check to make sure that a matched hash is actually
 | 
						// Because of this, we check to make sure that a matched hash is actually
 | 
				
			||||||
	// a commit in the repository before making it a link.
 | 
						// a commit in the repository before making it a link.
 | 
				
			||||||
	if ctx.metas["repoPath"] != "" {
 | 
						if ctx.metas["repoPath"] != "" {
 | 
				
			||||||
		if _, err := git.NewCommand("log", "-1", hash).RunInDirBytes(ctx.metas["repoPath"]); err != nil {
 | 
							repo, err := git.OpenRepository(ctx.metas["repoPath"])
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if !repo.IsCommitExist(hash) {
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user