Documentation
¶
Overview ¶
Package repo reads the tracked files and the checked-out commit of the repository being validated.
It reads Git's index and object database instead of the working tree, so it works on sparse and blobless (`--filter=blob:none`) checkouts that only contain the CODEOWNERS file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotRepository = errors.New("not a Git repository")
ErrNotRepository is returned by Head when the directory isn't in a Git repository.
Functions ¶
This section is empty.
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo is the repository being validated. It's safe for concurrent use.
func New ¶
New returns the repository in dir. If trust is set, Git commands mark dir as a safe directory, which is needed when dir is owned by another user, for example a workspace mounted into a container. See https://github.com/actions/checkout/issues/766.
func (*Repo) Files ¶
Files returns the slash-separated paths of the files tracked in the repository's index, relative to the repository directory and sorted bytewise. If the directory isn't in a Git repository, it returns the files in the directory instead, skipping .git directories.
The result is computed once and shared; callers must not modify it.