Add "gitCache" template function

This not only returns the path to the "git cache" directory, but ensures it is initialized and that `git` commands against it will generally succeed.
This commit is contained in:
Tianon Gravi 2023-01-30 14:25:51 -08:00
parent c7d3d0d935
commit cec429fa53
1 changed files with 7 additions and 0 deletions

View File

@ -56,6 +56,13 @@ func cmdCat(c *cli.Context) error {
"arch": func() string {
return arch
},
"gitCache": func() (string, error) {
err := ensureGitInit()
if err != nil {
return "", err
}
return gitCache(), nil
},
"ociPlatform": func(arch string) *architecture.OCIPlatform {
if ociArch, ok := architecture.SupportedArches[arch]; ok {
return &ociArch