diff --git a/internal/git/git.go b/internal/git/git.go index 05e2ab70fdcebb694767944653f64642d0787c43..728304d457ff1da377736390f17842c2f10def48 100644 --- a/internal/git/git.go +++ b/internal/git/git.go @@ -222,7 +222,8 @@ func (rs *RepoSource) LoadRepos() error { return nil } -// LatestFile returns the contents of the latest file at the specified path in the repository. +// LatestFile returns the contents of the latest file at the specified path in +// the repository and its file path. func (r *Repo) LatestFile(pattern string) (string, string, error) { g := glob.MustCompile(pattern) dir := filepath.Dir(pattern) @@ -236,6 +237,9 @@ func (r *Repo) LatestFile(pattern string) (string, string, error) { } for _, e := range ents { fp := filepath.Join(dir, e.Name()) + if e.IsTree() { + continue + } if g.Match(fp) { bts, err := e.Contents() if err != nil {