package repository import ( "context" "errors" "alin.ovh/erl/repository/git" ) type Repo struct { root string kind RepoType ignoreFileNames []string } var ErrNotRepo = errors.New("not a repository") func GetRepo(ctx context.Context, wd string) (*Repo, error) { var ( matches bool root string err error ) matches, root, err = git.IsGitRepo(ctx, wd) if err != nil { return nil, err } if matches { return &Repo{ root: root, kind: Git, ignoreFileNames: []string{".gitignore"}, }, nil } return nil, ErrNotRepo } func (r Repo) GetRoot() string { return r.root } func (r Repo) GetKind() RepoType { return r.kind } func (r Repo) GetIgnoreFileNames() []string { return r.ignoreFileNames }