gitutils

package
v0.0.0-...-cc84adf Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrGitRevisionNotFound = errors.New("git revision not found")

Functions

func Commit

func Commit(_ context.Context, fileNames []string, message string) error

func GetCurrentBranch

func GetCurrentBranch(_ context.Context, path string) (string, error)

func OpenRepository

func OpenRepository(path string) (*git.Repository, error)

Types

type GitCommit

type GitCommit struct {
	Commit    string
	Parents   []string
	Author    GitCommitAuthor
	Committer GitCommitAuthor
	Message   string
	Tags      []string
}

func GetLastVersionGit

func GetLastVersionGit(ctx context.Context, c *config.ComponentConfig, origin string) ([]GitCommit, error)

func GetRecentCommits

func GetRecentCommits(ctx context.Context, basePath string, baseRevision, targetRevision string, filterPaths []string) ([]GitCommit, error)

GetRecentCommits returns all commits in descending order (newest first) baseRef is the commit to start from, if empty the current HEAD is used

type GitCommitAuthor

type GitCommitAuthor struct {
	Name  string
	Email string
	Date  time.Time
}

type GitRepository

type GitRepository interface {
	GetCurrentBranch(context.Context, string) (string, error)
	GetVersionInfo(ctx context.Context, path string, branch string) (*GitVersionInfo, error)
	GetRecentCommits(ctx context.Context, basePath string, baseRevision, targetRevision string, filterPaths []string) ([]GitCommit, error)
}

type GitRepositoryWrapper

type GitRepositoryWrapper struct {
}

func NewGitRepositoryWrapper

func NewGitRepositoryWrapper() *GitRepositoryWrapper

func (GitRepositoryWrapper) GetCurrentBranch

func (g GitRepositoryWrapper) GetCurrentBranch(ctx context.Context, s string) (string, error)

func (GitRepositoryWrapper) GetRecentCommits

func (g GitRepositoryWrapper) GetRecentCommits(ctx context.Context, basePath string, baseRevision, targetRevision string, filterPaths []string) ([]GitCommit, error)

func (GitRepositoryWrapper) GetVersionInfo

func (g GitRepositoryWrapper) GetVersionInfo(ctx context.Context, path string, branch string) (*GitVersionInfo, error)

type GitSource

type GitSource struct {
	URL        string
	Repository string
	Path       string
	Name       string
}

type GitVersionInfo

type GitVersionInfo struct {
	Hash     plumbing.Hash
	Tag      string
	Revision plumbing.Revision
}

func GetVersionInfo

func GetVersionInfo(_ context.Context, path string, branch string) (*GitVersionInfo, error)

GetVersionInfo returns the latest commit hash of a specific branch

func (*GitVersionInfo) Identifier

func (g *GitVersionInfo) Identifier() string

Jump to

Keyboard shortcuts

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