Documentation ¶
Index ¶
Constants ¶
const EmptyTreeID = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
EmptyTreeID is the universal git empty tree sha1.
Variables ¶
var ErrDirNotValid = errors.New(`invalid dir path, it can't be ".", "..", start by "/" or contain "./"`)
var MatchAllTags = regexp.MustCompile("")
Functions ¶
This section is empty.
Types ¶
type CommitFilter ¶
type CommitFilter struct {
// contains filtered or unexported fields
}
CommitFilter filters commits from a git repository based in included and excluded directories.
func NewCommitFilter ¶
func NewCommitFilter(commitsGetter CommitsGetter, opts ...CommitFilterOptionFunc) (*CommitFilter, error)
func (*CommitFilter) Commits ¶
func (s *CommitFilter) Commits(lastHash string) ([]Commit, error)
Commits calls commitGetter to get a list of commits until lastHash. If includedDirs is not empty, only commits changing at least one file contained in any of the includedDirs will be returned. If excludedDirs is not empty, commits that only change files present in excludedDirs will be filtered out.
type CommitFilterOptionFunc ¶
type CommitFilterOptionFunc func(s *CommitFilter) error
func ExcludedDirs ¶
func ExcludedDirs(excludedDirs ...string) CommitFilterOptionFunc
ExcludedDirs returns an option that will filter commits with all changes in excludedDirs.
func IncludedDirs ¶
func IncludedDirs(includedDirs ...string) CommitFilterOptionFunc
IncludedDirs returns an option that will filter commits with all changes not in includedDirs.
type CommitsGetter ¶
type RepoCommitsGetter ¶
type RepoCommitsGetter struct {
// contains filtered or unexported fields
}
RepoCommitsGetter gets commits from a git repository.
func NewRepoCommitsGetter ¶
func NewRepoCommitsGetter(workDir string) *RepoCommitsGetter
type RepoTagsGetter ¶
type RepoTagsGetter struct {
// contains filtered or unexported fields
}
func NewRepoTagsGetter ¶
func NewRepoTagsGetter(workDir string, opts ...TagOptionFunc) (*RepoTagsGetter, error)
func (*RepoTagsGetter) Tags ¶
func (s *RepoTagsGetter) Tags() ([]Tag, error)
type TagOptionFunc ¶
type TagOptionFunc func(s *RepoTagsGetter) error
func TagsMatching ¶
func TagsMatching(regex string) TagOptionFunc
TagsMatching returns an option that will make the getter to ignore tags that do not match regex.
type TagSourceOptionFunc ¶
type TagSourceOptionFunc func(s *TagsSource)
func TagSourceReplacing ¶
func TagSourceReplacing(existing, replacement string) TagSourceOptionFunc
TagSourceReplacing returns an option that will perform a string replacement on tags that match the regex before attempting to parse them as versions. It is useful to, for example, strip prefixes from tags matched with TagMatching.
type TagsGetter ¶
type TagsSource ¶
type TagsSource struct {
// contains filtered or unexported fields
}
TagsSource implements the `version.Source` interface, using tags from a git repository as a source for previous versions. It also implements TagsVersionGetter to be used by extractor services.
func NewTagsSource ¶
func NewTagsSource(tagsGetter TagsGetter, opts ...TagSourceOptionFunc) *TagsSource
func (*TagsSource) LastVersionHash ¶
func (s *TagsSource) LastVersionHash() (string, error)