Documentation
¶
Overview ¶
Package git provides Git operations and error definitions.
Package git is a generated GoMock package.
Index ¶
- Variables
- type BranchExistsOnRemoteParams
- type CloneParams
- type Git
- type MockGit
- func (m *MockGit) Add(repoPath string, files ...string) error
- func (m *MockGit) AddRemote(repoPath, remoteName, remoteURL string) error
- func (m *MockGit) BranchExists(repoPath, branch string) (bool, error)
- func (m *MockGit) BranchExistsOnRemote(params BranchExistsOnRemoteParams) (bool, error)
- func (m *MockGit) Clone(params CloneParams) error
- func (m *MockGit) Commit(repoPath, message string) error
- func (m *MockGit) ConfigGet(workDir, key string) (string, error)
- func (m *MockGit) CreateBranch(repoPath, branch string) error
- func (m *MockGit) CreateWorktree(repoPath, worktreePath, branch string) error
- func (m *MockGit) EXPECT() *MockGitMockRecorder
- func (m *MockGit) FetchRemote(repoPath, remoteName string) error
- func (m *MockGit) GetBranchRemote(repoPath, branch string) (string, error)
- func (m *MockGit) GetCurrentBranch(repoPath string) (string, error)
- func (m *MockGit) GetDefaultBranch(remoteURL string) (string, error)
- func (m *MockGit) GetRemoteURL(repoPath, remoteName string) (string, error)
- func (m *MockGit) GetRepositoryName(repoPath string) (string, error)
- func (m *MockGit) GetWorktreePath(repoPath, branch string) (string, error)
- func (m *MockGit) IsClean(repoPath string) (bool, error)
- func (m *MockGit) RemoteExists(repoPath, remoteName string) (bool, error)
- func (m *MockGit) RemoveWorktree(repoPath, worktreePath string) error
- func (m *MockGit) Status(workDir string) (string, error)
- func (m *MockGit) WorktreeExists(repoPath, branch string) (bool, error)
- type MockGitMockRecorder
- func (mr *MockGitMockRecorder) Add(repoPath any, files ...any) *gomock.Call
- func (mr *MockGitMockRecorder) AddRemote(repoPath, remoteName, remoteURL any) *gomock.Call
- func (mr *MockGitMockRecorder) BranchExists(repoPath, branch any) *gomock.Call
- func (mr *MockGitMockRecorder) BranchExistsOnRemote(params any) *gomock.Call
- func (mr *MockGitMockRecorder) Clone(params any) *gomock.Call
- func (mr *MockGitMockRecorder) Commit(repoPath, message any) *gomock.Call
- func (mr *MockGitMockRecorder) ConfigGet(workDir, key any) *gomock.Call
- func (mr *MockGitMockRecorder) CreateBranch(repoPath, branch any) *gomock.Call
- func (mr *MockGitMockRecorder) CreateWorktree(repoPath, worktreePath, branch any) *gomock.Call
- func (mr *MockGitMockRecorder) FetchRemote(repoPath, remoteName any) *gomock.Call
- func (mr *MockGitMockRecorder) GetBranchRemote(repoPath, branch any) *gomock.Call
- func (mr *MockGitMockRecorder) GetCurrentBranch(repoPath any) *gomock.Call
- func (mr *MockGitMockRecorder) GetDefaultBranch(remoteURL any) *gomock.Call
- func (mr *MockGitMockRecorder) GetRemoteURL(repoPath, remoteName any) *gomock.Call
- func (mr *MockGitMockRecorder) GetRepositoryName(repoPath any) *gomock.Call
- func (mr *MockGitMockRecorder) GetWorktreePath(repoPath, branch any) *gomock.Call
- func (mr *MockGitMockRecorder) IsClean(repoPath any) *gomock.Call
- func (mr *MockGitMockRecorder) RemoteExists(repoPath, remoteName any) *gomock.Call
- func (mr *MockGitMockRecorder) RemoveWorktree(repoPath, worktreePath any) *gomock.Call
- func (mr *MockGitMockRecorder) Status(workDir any) *gomock.Call
- func (mr *MockGitMockRecorder) WorktreeExists(repoPath, branch any) *gomock.Call
Constants ¶
This section is empty.
Variables ¶
var ( ErrGitCommandFailed = errors.New("git command failed") ErrBranchNotFound = errors.New("branch not found") ErrWorktreeExists = errors.New("worktree already exists") ErrWorktreeNotFound = errors.New("worktree not found") ErrWorktreeDeletionFailed = errors.New("failed to delete worktree") ErrWorktreePathNotFound = errors.New("worktree path not found") ErrRepositoryNotClean = errors.New("repository is not clean") ErrRemoteOriginNotFound = errors.New("remote origin not found") ErrRemoteNotFound = errors.New("remote not found") ErrRemoteAddFailed = errors.New("failed to add remote") ErrFetchFailed = errors.New("failed to fetch from remote") ErrBranchNotFoundOnRemote = errors.New("branch not found on remote") )
Git-specific error types.
Functions ¶
This section is empty.
Types ¶
type BranchExistsOnRemoteParams ¶
BranchExistsOnRemoteParams contains parameters for BranchExistsOnRemote.
type CloneParams ¶
CloneParams contains parameters for Clone.
type Git ¶
type Git interface { // Status executes `git status` in specified directory. Status(workDir string) (string, error) // ConfigGet executes `git config --get <key>` in specified directory. ConfigGet(workDir, key string) (string, error) // CreateWorktree creates a new worktree for the specified branch. CreateWorktree(repoPath, worktreePath, branch string) error // GetCurrentBranch gets the current branch name. GetCurrentBranch(repoPath string) (string, error) // GetRepositoryName gets the repository name from remote origin URL with fallback to local path. GetRepositoryName(repoPath string) (string, error) // IsClean checks if the repository is in a clean state (placeholder for future validation). IsClean(repoPath string) (bool, error) // BranchExists checks if a branch exists locally or remotely. BranchExists(repoPath, branch string) (bool, error) // CreateBranch creates a new branch from the current branch. CreateBranch(repoPath, branch string) error // WorktreeExists checks if a worktree exists for the specified branch. WorktreeExists(repoPath, branch string) (bool, error) // RemoveWorktree removes a worktree from Git's tracking. RemoveWorktree(repoPath, worktreePath string) error // GetWorktreePath gets the path of a worktree for a branch. GetWorktreePath(repoPath, branch string) (string, error) // AddRemote adds a new remote to the repository. AddRemote(repoPath, remoteName, remoteURL string) error // FetchRemote fetches from a specific remote. FetchRemote(repoPath, remoteName string) error // BranchExistsOnRemote checks if a branch exists on a specific remote. BranchExistsOnRemote(params BranchExistsOnRemoteParams) (bool, error) // GetRemoteURL gets the URL of a remote. GetRemoteURL(repoPath, remoteName string) (string, error) // RemoteExists checks if a remote exists. RemoteExists(repoPath, remoteName string) (bool, error) // GetBranchRemote gets the remote name for a branch (e.g., "origin", "justenstall"). GetBranchRemote(repoPath, branch string) (string, error) // Add adds files to the Git staging area. Add(repoPath string, files ...string) error // Commit creates a new commit with the specified message. Commit(repoPath, message string) error // Clone clones a repository to the specified path. Clone(params CloneParams) error // GetDefaultBranch gets the default branch name from a remote repository. GetDefaultBranch(remoteURL string) (string, error) }
Git interface provides Git command execution capabilities.
type MockGit ¶
type MockGit struct {
// contains filtered or unexported fields
}
MockGit is a mock of Git interface.
func NewMockGit ¶
func NewMockGit(ctrl *gomock.Controller) *MockGit
NewMockGit creates a new mock instance.
func (*MockGit) BranchExists ¶
BranchExists mocks base method.
func (*MockGit) BranchExistsOnRemote ¶
func (m *MockGit) BranchExistsOnRemote(params BranchExistsOnRemoteParams) (bool, error)
BranchExistsOnRemote mocks base method.
func (*MockGit) CreateBranch ¶
CreateBranch mocks base method.
func (*MockGit) CreateWorktree ¶
CreateWorktree mocks base method.
func (*MockGit) EXPECT ¶
func (m *MockGit) EXPECT() *MockGitMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockGit) FetchRemote ¶
FetchRemote mocks base method.
func (*MockGit) GetBranchRemote ¶
GetBranchRemote mocks base method.
func (*MockGit) GetCurrentBranch ¶
GetCurrentBranch mocks base method.
func (*MockGit) GetDefaultBranch ¶
GetDefaultBranch mocks base method.
func (*MockGit) GetRemoteURL ¶
GetRemoteURL mocks base method.
func (*MockGit) GetRepositoryName ¶
GetRepositoryName mocks base method.
func (*MockGit) GetWorktreePath ¶
GetWorktreePath mocks base method.
func (*MockGit) RemoteExists ¶
RemoteExists mocks base method.
func (*MockGit) RemoveWorktree ¶
RemoveWorktree mocks base method.
type MockGitMockRecorder ¶
type MockGitMockRecorder struct {
// contains filtered or unexported fields
}
MockGitMockRecorder is the mock recorder for MockGit.
func (*MockGitMockRecorder) Add ¶
func (mr *MockGitMockRecorder) Add(repoPath any, files ...any) *gomock.Call
Add indicates an expected call of Add.
func (*MockGitMockRecorder) AddRemote ¶
func (mr *MockGitMockRecorder) AddRemote(repoPath, remoteName, remoteURL any) *gomock.Call
AddRemote indicates an expected call of AddRemote.
func (*MockGitMockRecorder) BranchExists ¶
func (mr *MockGitMockRecorder) BranchExists(repoPath, branch any) *gomock.Call
BranchExists indicates an expected call of BranchExists.
func (*MockGitMockRecorder) BranchExistsOnRemote ¶
func (mr *MockGitMockRecorder) BranchExistsOnRemote(params any) *gomock.Call
BranchExistsOnRemote indicates an expected call of BranchExistsOnRemote.
func (*MockGitMockRecorder) Clone ¶
func (mr *MockGitMockRecorder) Clone(params any) *gomock.Call
Clone indicates an expected call of Clone.
func (*MockGitMockRecorder) Commit ¶
func (mr *MockGitMockRecorder) Commit(repoPath, message any) *gomock.Call
Commit indicates an expected call of Commit.
func (*MockGitMockRecorder) ConfigGet ¶
func (mr *MockGitMockRecorder) ConfigGet(workDir, key any) *gomock.Call
ConfigGet indicates an expected call of ConfigGet.
func (*MockGitMockRecorder) CreateBranch ¶
func (mr *MockGitMockRecorder) CreateBranch(repoPath, branch any) *gomock.Call
CreateBranch indicates an expected call of CreateBranch.
func (*MockGitMockRecorder) CreateWorktree ¶
func (mr *MockGitMockRecorder) CreateWorktree(repoPath, worktreePath, branch any) *gomock.Call
CreateWorktree indicates an expected call of CreateWorktree.
func (*MockGitMockRecorder) FetchRemote ¶
func (mr *MockGitMockRecorder) FetchRemote(repoPath, remoteName any) *gomock.Call
FetchRemote indicates an expected call of FetchRemote.
func (*MockGitMockRecorder) GetBranchRemote ¶
func (mr *MockGitMockRecorder) GetBranchRemote(repoPath, branch any) *gomock.Call
GetBranchRemote indicates an expected call of GetBranchRemote.
func (*MockGitMockRecorder) GetCurrentBranch ¶
func (mr *MockGitMockRecorder) GetCurrentBranch(repoPath any) *gomock.Call
GetCurrentBranch indicates an expected call of GetCurrentBranch.
func (*MockGitMockRecorder) GetDefaultBranch ¶
func (mr *MockGitMockRecorder) GetDefaultBranch(remoteURL any) *gomock.Call
GetDefaultBranch indicates an expected call of GetDefaultBranch.
func (*MockGitMockRecorder) GetRemoteURL ¶
func (mr *MockGitMockRecorder) GetRemoteURL(repoPath, remoteName any) *gomock.Call
GetRemoteURL indicates an expected call of GetRemoteURL.
func (*MockGitMockRecorder) GetRepositoryName ¶
func (mr *MockGitMockRecorder) GetRepositoryName(repoPath any) *gomock.Call
GetRepositoryName indicates an expected call of GetRepositoryName.
func (*MockGitMockRecorder) GetWorktreePath ¶
func (mr *MockGitMockRecorder) GetWorktreePath(repoPath, branch any) *gomock.Call
GetWorktreePath indicates an expected call of GetWorktreePath.
func (*MockGitMockRecorder) IsClean ¶
func (mr *MockGitMockRecorder) IsClean(repoPath any) *gomock.Call
IsClean indicates an expected call of IsClean.
func (*MockGitMockRecorder) RemoteExists ¶
func (mr *MockGitMockRecorder) RemoteExists(repoPath, remoteName any) *gomock.Call
RemoteExists indicates an expected call of RemoteExists.
func (*MockGitMockRecorder) RemoveWorktree ¶
func (mr *MockGitMockRecorder) RemoveWorktree(repoPath, worktreePath any) *gomock.Call
RemoveWorktree indicates an expected call of RemoveWorktree.
func (*MockGitMockRecorder) Status ¶
func (mr *MockGitMockRecorder) Status(workDir any) *gomock.Call
Status indicates an expected call of Status.
func (*MockGitMockRecorder) WorktreeExists ¶
func (mr *MockGitMockRecorder) WorktreeExists(repoPath, branch any) *gomock.Call
WorktreeExists indicates an expected call of WorktreeExists.