Documentation
¶
Index ¶
Constants ¶
const ( // Store is the storage used by locator to store cloned configs. Store = datadir.Store("locator") // ConfigFile is the name of the config file for the locator. ConfigFile = "config.json" )
Variables ¶
var ( ErrRepositoryNotFound = errors.New("repository not found") ErrEmptyBranch = errors.New("empty branch") )
related errors
var ErrInvalidCommit = errors.New("invalid commit")
ErrInvalidCommit is returned when the commit is invalid.
Functions ¶
This section is empty.
Types ¶
type CommitList ¶
type CommitList []Commit
func (CommitList) AsOptions ¶
func (c CommitList) AsOptions() []string
type Git ¶
type Git string
Git manages a given git repository. It holds the path to the repository path.
func (Git) Commits ¶
func (g Git) Commits(branch string) (CommitList, error)
Commits returns the list of commits in the given branch.
func (Git) RepoExists ¶
RepoExists returns true if a repository exists at the given path.
type Locator ¶
type Locator struct { Provider Provider `json:"provider"` Protocol string `json:"protocol"` Repository string `json:"repository"` Branch string `json:"branch"` Commit string `json:"commit"` Path string `json:"path"` }
Locator contains the configuration for the locator. Do not 'omitempty' on fields in this struct, as we test if the Checksum contains all the fields by marshaling it to JSON. Therefore, if you omit empty fields, test may be false-negative.
func LoadFromStore ¶
LoadFromStore loads a Locator from a config.json in store or fails if it does not exist.
func (*Locator) Checksum ¶
Checksum returns the unique id of the locator, it may be used as a file name.
func (*Locator) Commits ¶
func (l *Locator) Commits() (CommitList, error)