mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-06 19:08:57 +09:00
fix: git cache (#38763)
1. always use "last commit cache" 2. correctly build the cache key for any input (SafeCacheKey) 3. fix the git note "last commit cache FIXME" and avoid OOM
This commit is contained in:
@@ -66,10 +66,7 @@ func (c *Commit) ParentCount() int {
|
||||
|
||||
// GetCommitByPath return the commit of relative path object.
|
||||
func (c *Commit) GetCommitByPath(ctx context.Context, gitRepo *Repository, relpath string) (*Commit, error) {
|
||||
if gitRepo.LastCommitCache != nil {
|
||||
return gitRepo.LastCommitCache.GetCommitByPath(ctx, c.ID.String(), relpath)
|
||||
}
|
||||
return gitRepo.getCommitByPathWithID(ctx, c.ID, relpath)
|
||||
return gitRepo.LastCommitCache.GetCommitByPath(ctx, c.ID, relpath)
|
||||
}
|
||||
|
||||
func (c *Commit) Tree() *Tree {
|
||||
|
||||
Reference in New Issue
Block a user