mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-07 16:39:03 +00:00
deccd53c24
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
20 lines
458 B
Go
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)
|
|
}
|