Documentation
¶
Index ¶
- func IsMainBranch(currentBranch string, mainBranches []string) bool
- func SanitizeBranchName(branch string) string
- func StripTagPrefix(tag, prefix string) string
- type Repo
- func (g *Repo) CheckMainBranchHasNewCommitsSinceBranchPoint(mainBranch, currentBranch string) (bool, error)
- func (g *Repo) CheckMainBranchHasNewTagsSinceBranchPoint(mainBranch, currentBranch string) (bool, string, error)
- func (g *Repo) GetCommitCount() (int, error)
- func (g *Repo) GetCommitCountSinceBranchPoint(mainBranch, currentBranch string) (int, error)
- func (g *Repo) GetCurrentBranch() (string, error)
- func (g *Repo) GetMainBranch(mainBranches []string) (string, error)
- func (g *Repo) GetMainBranchCommitCount(mainBranch string) (int, error)
- func (g *Repo) GetMainBranchCommitsSinceBranchPoint(mainBranch, currentBranch string) (int, error)
- func (g *Repo) GetMostRecentTag(tagPrefix string) (string, int, error)
- func (g *Repo) GetTagOnCurrentCommit() (string, error)
- func (g *Repo) IsShallow() (bool, error)
- func (g *Repo) IsTagInHistory(tagName string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsMainBranch ¶ added in v1.0.21
IsMainBranch checks if the given branch name matches any of the main branches
func SanitizeBranchName ¶
SanitizeBranchName converts a branch name to a valid prerelease identifier
func StripTagPrefix ¶
StripTagPrefix removes the configured prefix from a tag name
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo represents a git repository
func (*Repo) CheckMainBranchHasNewCommitsSinceBranchPoint ¶ added in v1.0.43
func (g *Repo) CheckMainBranchHasNewCommitsSinceBranchPoint(mainBranch, currentBranch string) (bool, error)
CheckMainBranchHasNewCommitsSinceBranchPoint checks if main branch has any new commits after the current branch diverged from it. Returns true if main has moved forward since the branch point. This is useful for detecting if a feature branch is outdated regardless of tags.
func (*Repo) CheckMainBranchHasNewTagsSinceBranchPoint ¶ added in v1.0.43
func (g *Repo) CheckMainBranchHasNewTagsSinceBranchPoint(mainBranch, currentBranch string) (bool, string, error)
CheckMainBranchHasNewTagsSinceBranchPoint checks if main branch has been tagged after the current branch diverged from it. Returns true if main has new tags, along with the most recent tag name on main if found.
func (*Repo) GetCommitCount ¶
GetCommitCount returns the number of commits on the current branch
func (*Repo) GetCommitCountSinceBranchPoint ¶
GetCommitCountSinceBranchPoint returns the number of commits since branching from main This uses a proper merge-base algorithm to find the common ancestor
func (*Repo) GetCurrentBranch ¶
GetCurrentBranch returns the name of the current branch
func (*Repo) GetMainBranch ¶ added in v1.0.21
GetMainBranch returns the first main branch that exists in the repository It checks both local and remote branches to handle detached HEAD states in CI
func (*Repo) GetMainBranchCommitCount ¶
GetMainBranchCommitCount returns the commit count on the main branch It checks both local and remote branches to handle detached HEAD states in CI
func (*Repo) GetMainBranchCommitsSinceBranchPoint ¶ added in v1.0.41
GetMainBranchCommitsSinceBranchPoint returns the number of commits on main branch since the point where the current branch diverged from main
func (*Repo) GetMostRecentTag ¶ added in v1.0.14
GetMostRecentTag returns the most recent tag that is reachable from HEAD Only tags that are in the current branch's history (merged) are considered If tagPrefix is provided, only tags with that prefix are considered Returns the tag name and commits since that tag (0 if we're on the tag) The "most recent" tag is determined by highest semantic version, not by commit date
func (*Repo) GetTagOnCurrentCommit ¶
GetTagOnCurrentCommit returns the tag on the current HEAD commit, if any When multiple tags point to the same commit, it returns the one with the highest semantic version