Documentation
¶
Index ¶
- Constants
- Variables
- type Commit
- type CommitFilter
- type CommitFilterOptionFunc
- func ExcludedDependencies(deps ...string) CommitFilterOptionFunc
- func ExcludedDirs(excludedDirs ...string) CommitFilterOptionFunc
- func ExcludedFiles(excludedFiles ...string) CommitFilterOptionFunc
- func IncludedDirs(includedDirs ...string) CommitFilterOptionFunc
- func IncludedFiles(includedFiles ...string) CommitFilterOptionFunc
- type CommitsGetter
- type RepoCommitsGetter
- type RepoTagsGetter
- type Tag
- type TagOptionFunc
- type TagSourceOptionFunc
- type TagsGetter
- type TagsSource
- type TagsVersionGetter
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 "./"`) ErrFileNotValid = errors.New(`invalid file path, it can't be "",".", "..", start or end by "/" or contain "./"`) )
var ErrNoReleases = errors.New("no releases found")
var ErrNonexistentCommitHash = fmt.Errorf("nonexistent commit hash")
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 or includedFiles is not empty, commits changing only files not contained in any of the includedDirs or includedFiles will be filtered out. Moreover, commits modifying only files present in excludedDirs or excludedFiles will be filtered out. Notice that if a file is excluded by a rule it is filtered out, even if another rule include it.
type CommitFilterOptionFunc ¶
type CommitFilterOptionFunc func(s *CommitFilter) error
func ExcludedDependencies ¶
func ExcludedDependencies(deps ...string) CommitFilterOptionFunc
func ExcludedDirs ¶
func ExcludedDirs(excludedDirs ...string) CommitFilterOptionFunc
ExcludedDirs returns an option that will filter commits with all changes in excludedDirs.
func ExcludedFiles ¶
func ExcludedFiles(excludedFiles ...string) CommitFilterOptionFunc
ExcludedFiles returns an option that will filter commits with all changes in excludedFiles.
func IncludedDirs ¶
func IncludedDirs(includedDirs ...string) CommitFilterOptionFunc
IncludedDirs returns an option that will filter commits with all changes not in includedDirs.
func IncludedFiles ¶
func IncludedFiles(includedFiles ...string) CommitFilterOptionFunc
IncludedFiles returns an option that will filter commits with all changes not in includedFiles.
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 TagsMatchingCommits ¶
func TagsMatchingCommits(getter CommitsGetter) TagOptionFunc
TagsMatchingCommits returns an option that will skip tags that do not point to a commit reachable from HEAD.
func TagsMatchingRegex ¶
func TagsMatchingRegex(regex string) TagOptionFunc
TagsMatchingRegex 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)