git

package
v1.202.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package git is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalRepo

func GetLocalRepo() (*git.Repository, error)

func GetRepoConfig

func GetRepoConfig(repo *git.Repository) (*config.Config, error)

func OpenWorktreeAwareRepo added in v1.191.0

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

OpenWorktreeAwareRepo opens a Git repository at the given path, handling both regular repositories and worktrees correctly. It uses EnableDotGitCommonDir to properly support worktrees with access to the main repository's config, remotes, and references.

Types

type DefaultGitRepo added in v1.192.0

type DefaultGitRepo struct{}

DefaultGitRepo is the default implementation of GitRepoInterface.

func (*DefaultGitRepo) GetCurrentCommitSHA added in v1.192.0

func (d *DefaultGitRepo) GetCurrentCommitSHA() (string, error)

GetCurrentCommitSHA returns the SHA of the current HEAD commit.

func (*DefaultGitRepo) GetLocalRepoInfo added in v1.192.0

func (d *DefaultGitRepo) GetLocalRepoInfo() (*RepoInfo, error)

GetLocalRepoInfo returns information about the local git repository.

func (*DefaultGitRepo) GetRepoInfo added in v1.192.0

func (d *DefaultGitRepo) GetRepoInfo(repo *git.Repository) (RepoInfo, error)

GetRepoInfo returns the repository information for the given git.Repository.

type DefaultRepositoryOperations added in v1.195.0

type DefaultRepositoryOperations struct{}

DefaultRepositoryOperations implements RepositoryOperations using real git operations.

func (*DefaultRepositoryOperations) GetLocalRepo added in v1.195.0

func (d *DefaultRepositoryOperations) GetLocalRepo() (*git.Repository, error)

GetLocalRepo opens the local git repository.

func (*DefaultRepositoryOperations) GetRepoInfo added in v1.195.0

func (d *DefaultRepositoryOperations) GetRepoInfo(localRepo *git.Repository) (RepoInfo, error)

GetRepoInfo extracts repository information.

type GitRepoInterface added in v1.192.0

type GitRepoInterface interface {
	GetLocalRepoInfo() (*RepoInfo, error)
	GetRepoInfo(repo *git.Repository) (RepoInfo, error)
	GetCurrentCommitSHA() (string, error)
}

GitRepoInterface defines the interface for git repository operations.

func NewDefaultGitRepo added in v1.192.0

func NewDefaultGitRepo() GitRepoInterface

NewDefaultGitRepo creates a new instance of DefaultGitRepo.

type MockRepositoryOperations added in v1.195.0

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

MockRepositoryOperations is a mock of RepositoryOperations interface.

func NewMockRepositoryOperations added in v1.195.0

func NewMockRepositoryOperations(ctrl *gomock.Controller) *MockRepositoryOperations

NewMockRepositoryOperations creates a new mock instance.

func (*MockRepositoryOperations) EXPECT added in v1.195.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRepositoryOperations) GetLocalRepo added in v1.195.0

func (m *MockRepositoryOperations) GetLocalRepo() (*v5.Repository, error)

GetLocalRepo mocks base method.

func (*MockRepositoryOperations) GetRepoInfo added in v1.195.0

func (m *MockRepositoryOperations) GetRepoInfo(localRepo *v5.Repository) (RepoInfo, error)

GetRepoInfo mocks base method.

type MockRepositoryOperationsMockRecorder added in v1.195.0

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

MockRepositoryOperationsMockRecorder is the mock recorder for MockRepositoryOperations.

func (*MockRepositoryOperationsMockRecorder) GetLocalRepo added in v1.195.0

func (mr *MockRepositoryOperationsMockRecorder) GetLocalRepo() *gomock.Call

GetLocalRepo indicates an expected call of GetLocalRepo.

func (*MockRepositoryOperationsMockRecorder) GetRepoInfo added in v1.195.0

func (mr *MockRepositoryOperationsMockRecorder) GetRepoInfo(localRepo interface{}) *gomock.Call

GetRepoInfo indicates an expected call of GetRepoInfo.

type RepoInfo

type RepoInfo struct {
	LocalRepoPath     string
	LocalWorktree     *git.Worktree
	LocalWorktreePath string
	RepoUrl           string
	RepoOwner         string
	RepoName          string
	RepoHost          string
}

func GetRepoInfo

func GetRepoInfo(localRepo *git.Repository) (RepoInfo, error)

type RepositoryOperations added in v1.195.0

type RepositoryOperations interface {
	// GetLocalRepo opens the local git repository.
	GetLocalRepo() (*git.Repository, error)

	// GetRepoInfo extracts repository information (URL, name, owner, host).
	GetRepoInfo(localRepo *git.Repository) (RepoInfo, error)
}

RepositoryOperations defines operations for working with git repositories. This interface allows mocking of git operations in tests.

Jump to

Keyboard shortcuts

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