Documentation
¶
Index ¶
- Constants
- func CreateTag(tagName, message string) error
- func GetGitShortHash(hashLength int) (string, error)
- func GetHashLength() int
- func GetHashLengthFromConfig(configHashLength int) int
- func IsGitRepository() bool
- func IsWorkingDirectoryClean() (bool, error)
- func TagExists(tagName string) (bool, error)
- type GitVersionControlSystem
- func (g *GitVersionControlSystem) CreateTag(tagName, message string) error
- func (g *GitVersionControlSystem) GetBranchName() (string, error)
- func (g *GitVersionControlSystem) GetCommitAuthor() (string, error)
- func (g *GitVersionControlSystem) GetCommitAuthorEmail() (string, error)
- func (g *GitVersionControlSystem) GetCommitDate() (time.Time, error)
- func (g *GitVersionControlSystem) GetCommitsSinceTag() (int, error)
- func (g *GitVersionControlSystem) GetLastTag() (string, error)
- func (g *GitVersionControlSystem) GetLastTagCommit() (string, error)
- func (g *GitVersionControlSystem) GetRepositoryRoot() (string, error)
- func (g *GitVersionControlSystem) GetTemplateVariables(context map[string]string) map[string]string
- func (g *GitVersionControlSystem) GetUncommittedChanges() (int, error)
- func (g *GitVersionControlSystem) GetVCSIdentifier(length int) (string, error)
- func (g *GitVersionControlSystem) IsRepository() bool
- func (g *GitVersionControlSystem) IsWorkingDirectoryClean() (bool, error)
- func (g *GitVersionControlSystem) Name() string
- func (g *GitVersionControlSystem) TagExists(tagName string) (bool, error)
- func (g *GitVersionControlSystem) Types() plugin.PluginTypeSet
- type TagInfo
Constants ¶
const DefaultMaxCommitDepth = 10000
DefaultMaxCommitDepth is the maximum number of commits to walk when searching for tags
Variables ¶
This section is empty.
Functions ¶
func GetGitShortHash ¶
GetGitShortHash returns the short hash of the current HEAD commit with specified length
func GetHashLength ¶
func GetHashLength() int
GetHashLength returns the configured hash length from config file or environment variable Priority: 1) Config file, 2) VERSIONATOR_HASH_LENGTH env var, 3) Default (7)
func GetHashLengthFromConfig ¶
GetHashLengthFromConfig returns hash length from config, with fallback to environment/default
func IsGitRepository ¶
func IsGitRepository() bool
IsGitRepository checks if we're in a git repository
func IsWorkingDirectoryClean ¶
IsWorkingDirectoryClean checks if the git working directory is clean (no uncommitted changes)
Types ¶
type GitVersionControlSystem ¶
type GitVersionControlSystem struct {
// contains filtered or unexported fields
}
GitVersionControlSystem implements VersionControlSystem for Git
func NewGitVCS ¶
func NewGitVCS() *GitVersionControlSystem
NewGitVCS creates a new GitVersionControlSystem
func (*GitVersionControlSystem) CreateTag ¶
func (g *GitVersionControlSystem) CreateTag(tagName, message string) error
CreateTag creates a git tag
func (*GitVersionControlSystem) GetBranchName ¶
func (g *GitVersionControlSystem) GetBranchName() (string, error)
GetBranchName returns the current branch name
func (*GitVersionControlSystem) GetCommitAuthor ¶
func (g *GitVersionControlSystem) GetCommitAuthor() (string, error)
GetCommitAuthor returns the name of the current commit's author
func (*GitVersionControlSystem) GetCommitAuthorEmail ¶
func (g *GitVersionControlSystem) GetCommitAuthorEmail() (string, error)
GetCommitAuthorEmail returns the email of the current commit's author
func (*GitVersionControlSystem) GetCommitDate ¶
func (g *GitVersionControlSystem) GetCommitDate() (time.Time, error)
GetCommitDate returns the date of the current commit
func (*GitVersionControlSystem) GetCommitsSinceTag ¶
func (g *GitVersionControlSystem) GetCommitsSinceTag() (int, error)
GetCommitsSinceTag returns the number of commits since the most recent tag Returns 0 if on a tagged commit, -1 if no tags exist
func (*GitVersionControlSystem) GetLastTag ¶
func (g *GitVersionControlSystem) GetLastTag() (string, error)
GetLastTag returns the most recent semver tag Returns empty string if no tags exist
func (*GitVersionControlSystem) GetLastTagCommit ¶
func (g *GitVersionControlSystem) GetLastTagCommit() (string, error)
GetLastTagCommit returns the SHA of the commit the last tag points to
func (*GitVersionControlSystem) GetRepositoryRoot ¶
func (g *GitVersionControlSystem) GetRepositoryRoot() (string, error)
GetRepositoryRoot returns the root directory of the git repository
func (*GitVersionControlSystem) GetTemplateVariables ¶
func (g *GitVersionControlSystem) GetTemplateVariables(context map[string]string) map[string]string
GetTemplateVariables returns git-specific template variables
func (*GitVersionControlSystem) GetUncommittedChanges ¶
func (g *GitVersionControlSystem) GetUncommittedChanges() (int, error)
GetUncommittedChanges returns the count of uncommitted changes (staged + unstaged + untracked)
func (*GitVersionControlSystem) GetVCSIdentifier ¶
func (g *GitVersionControlSystem) GetVCSIdentifier(length int) (string, error)
GetVCSIdentifier returns a short hash of the current commit
func (*GitVersionControlSystem) IsRepository ¶
func (g *GitVersionControlSystem) IsRepository() bool
IsRepository checks if we're in a git repository
func (*GitVersionControlSystem) IsWorkingDirectoryClean ¶
func (g *GitVersionControlSystem) IsWorkingDirectoryClean() (bool, error)
IsWorkingDirectoryClean checks if there are no uncommitted changes
func (*GitVersionControlSystem) Name ¶
func (g *GitVersionControlSystem) Name() string
Name returns "git"
func (*GitVersionControlSystem) TagExists ¶
func (g *GitVersionControlSystem) TagExists(tagName string) (bool, error)
TagExists checks if a tag exists
func (*GitVersionControlSystem) Types ¶
func (g *GitVersionControlSystem) Types() plugin.PluginTypeSet
Types returns the set of plugin types this VCS implements