1package gitweb23import (4 "path"5 "path/filepath"6 "strings"78 "github.com/go-git/go-git/v5/plumbing/filemode"9)1011// RepoFile represents information for a single file/blob.12type RepoFile struct {13 mode filemode.FileMode14 Path string // Slash separated path15}1617func (f *RepoFile) Name() string {18 return path.Base(f.Path)19}2021func (f *RepoFile) FilePath() string {22 return filepath.FromSlash(f.Path)23}2425func (f *RepoFile) IsDir() bool {26 return f.mode == filemode.Dir27}2829func (f *RepoFile) IsSubmodule() bool {30 return f.mode == filemode.Submodule31}3233func (f *RepoFile) PathElements() []string {34 return strings.SplitN(f.Path, "/", -1)35}