gitcli

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: EUPL-1.2 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCommitNotFound indicates a commit was not found in git output.
	ErrCommitNotFound = errors.New("commit not found")
	// ErrUnexpectedGitLogFormat indicates the git log output is not parseable.
	ErrUnexpectedGitLogFormat = errors.New("unexpected git log format")
)

Functions

func DetectObjectFormat

func DetectObjectFormat(ctx context.Context, repoPath string) (string, error)

DetectObjectFormat returns the repository object format.

Types

type CommitReader

type CommitReader struct {
	// contains filtered or unexported fields
}

CommitReader reads commit data using the native git CLI.

func NewCommitReader

func NewCommitReader(repoPath string) *CommitReader

NewCommitReader creates a CLI-backed commit reader.

func (CommitReader) GetCommit

func (r CommitReader) GetCommit(ctx context.Context, ref string) (domain.Commit, error)

GetCommit retrieves a single commit by reference.

func (CommitReader) GetCommitRange

func (r CommitReader) GetCommitRange(ctx context.Context, fromRef, toRef string) ([]domain.Commit, error)

GetCommitRange retrieves commits in a range.

func (CommitReader) GetHeadCommits

func (r CommitReader) GetHeadCommits(ctx context.Context, count int) ([]domain.Commit, error)

GetHeadCommits retrieves the latest commits from HEAD.

type Repository added in v0.9.4

type Repository struct {
	CommitReader
}

Repository provides a git CLI-backed repository adapter.

func NewRepository added in v0.9.4

func NewRepository(repoPath string) *Repository

NewRepository creates a CLI-backed repository adapter.

func (Repository) BranchExists added in v0.9.4

func (r Repository) BranchExists(ctx context.Context, branchName string) bool

BranchExists checks if a branch reference exists locally or remotely.

func (Repository) GetCommitsAheadCount added in v0.9.4

func (r Repository) GetCommitsAheadCount(ctx context.Context, referenceBranch string) (int, error)

GetCommitsAheadCount returns how many commits HEAD is ahead of the reference.

func (Repository) GetCurrentBranch added in v0.9.4

func (r Repository) GetCurrentBranch(ctx context.Context) (string, error)

GetCurrentBranch returns the current branch name.

Jump to

Keyboard shortcuts

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