0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-12-10 15:24:54 +01:00

21 lines
463 B
Go

// Copyright 2020 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package repository
import (
"context"
"code.gitea.io/gitea/modules/git"
)
// CacheRef cache 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(fullRefName.String())
if err != nil {
return err
}
return gitRepo.CacheCommit(ctx, commit)
}