Files
Gitea/services/repository/cache.go
T
wxiaoguang deccd53c24 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
2026-08-05 00:17:07 +08:00

20 lines
458 B
Go

// Copyright 2020 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package repository
import (
"context"
"gitea.dev/modules/git"
)
// CacheRef caches last commit information of the branch or the tag
func CacheRef(ctx context.Context, gitRepo *git.Repository, fullRefName git.RefName) error {
commit, err := gitRepo.GetCommit(ctx, fullRefName.String())
if err != nil {
return err
}
return commit.CacheCommit(ctx, gitRepo)
}