gitutils

package
v0.0.0-...-3749d00 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoCommitsFound indicates that no commits were found since the given hash.
	ErrNoCommitsFound = errors.New("no commits found since given hash")
	// ErrNoValidVersionTags indicates that no valid version tags were found.
	ErrNoValidVersionTags = errors.New("no valid version tags found")
	// ErrNoTags indicates that no tags were found in the repository.
	ErrNoTags = errors.New("no tags found")
)

Functions

func GetCommitFromTag

func GetCommitFromTag(repo *git.Repository, tagRef *plumbing.Reference) (*object.Commit, error)

GetCommitFromTag retrieves the commit that a tag points to, handling both lightweight and annotated tags.

func GetCommitMessagesSinceCommitHash

func GetCommitMessagesSinceCommitHash(
	repo *git.Repository,
	commitHash plumbing.Hash,
) ([]string, error)

GetCommitMessagesSinceCommitHash returns the commit messages for all commits made after the specified commit hash. Returns ErrNoCommitsFound if no commits are found.

func GetCommitsSinceCommitHash

func GetCommitsSinceCommitHash(
	repo *git.Repository,
	commitHash plumbing.Hash,
) ([]*object.Commit, error)

GetCommitsSinceCommitHash returns all commits made after the specified commit hash. Returns ErrNoCommitsFound if no commits are found.

func GetLatestVersion

func GetLatestVersion(repo *git.Repository) (*semverutils.SemVer, error)

GetLatestVersion returns the latest semantic version as a SemVer struct. Returns ErrNoTags if no tags are found. Returns ErrNoValidVersionTags if no valid version tags are found.

Types

type TagInfo

type TagInfo struct {
	Name   string
	Commit *object.Commit
	TagRef *plumbing.Reference
}

TagInfo holds information about a git tag.

func GetLatestVersionTag

func GetLatestVersionTag(repo *git.Repository) (*TagInfo, error)

GetLatestVersionTag finds the most recent semantic version tag in the repository. Returns ErrNoValidVersionTags if no valid version tags are found. Returns ErrNoTags if no tags are found in the repository.

func GetTagsWithAssociatedCommits

func GetTagsWithAssociatedCommits(repo *git.Repository) ([]TagInfo, error)

GetTagsWithAssociatedCommits returns all tags in the repository with their associated commits. Returns ErrNoTags if no tags are found.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL