git

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	// GetDiff fetches the git diff based on parameters
	GetDiff(ctx context.Context, branch string, exclusions []string, contextSize int, includePaths []string, noTests bool, noPackage bool) (string, error)
	// GetDiffStat fetches the git diff --stat
	GetDiffStat(ctx context.Context, branch string, exclusions []string, includePaths []string, noTests bool, noPackage bool) (string, error)
	// FetchOrigin runs `git fetch origin`
	FetchOrigin(ctx context.Context) error
	// GetDiffFromClipboard reads diff from system clipboard
	GetDiffFromClipboard(ctx context.Context) (string, error)
	// GetCommitHistory fetches commit messages from a specified range
	GetCommitHistory(ctx context.Context, baseBranch string, head string) ([]string, error)
}

Adapter defines the interface for Git operations

type MockAdapter

type MockAdapter struct {
	MockDiff           string
	MockDiffStat       string
	MockCommitMessages []string
	MockError          error
}

MockAdapter provides a mock implementation for testing

func NewMockAdapter

func NewMockAdapter() *MockAdapter

NewMockAdapter creates a new mock adapter with sample data

func (*MockAdapter) FetchOrigin

func (m *MockAdapter) FetchOrigin(ctx context.Context) error

FetchOrigin implements the Adapter interface

func (*MockAdapter) GetCommitHistory

func (m *MockAdapter) GetCommitHistory(ctx context.Context, baseBranch string, head string) ([]string, error)

GetCommitHistory implements the Adapter interface with mock data

func (*MockAdapter) GetDiff

func (m *MockAdapter) GetDiff(ctx context.Context, branch string, exclusions []string, contextSize int, includePaths []string, noTests bool, noPackage bool) (string, error)

GetDiff implements the Adapter interface with mock data

func (*MockAdapter) GetDiffFromClipboard

func (m *MockAdapter) GetDiffFromClipboard(ctx context.Context) (string, error)

GetDiffFromClipboard implements the Adapter interface with mock data

func (*MockAdapter) GetDiffStat

func (m *MockAdapter) GetDiffStat(ctx context.Context, branch string, exclusions []string, includePaths []string, noTests bool, noPackage bool) (string, error)

GetDiffStat implements the Adapter interface with mock data

Jump to

Keyboard shortcuts

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