Documentation
¶
Overview ¶
Package git wraps git CLI operations behind a testable interface.
Index ¶
- type RealRunner
- func (r *RealRunner) AddWorktree(ctx context.Context, bareRepo, worktreePath, branch string) error
- func (r *RealRunner) AddWorktreeNewBranch(ctx context.Context, bareRepo, worktreePath, newBranch, startPoint string) error
- func (r *RealRunner) BareClone(ctx context.Context, url, dest string) error
- func (r *RealRunner) BranchExists(ctx context.Context, bareRepo, branch string) (bool, error)
- func (r *RealRunner) DefaultBranch(ctx context.Context, bareRepo string) (string, error)
- func (r *RealRunner) Fetch(ctx context.Context, repoPath string) error
- func (r *RealRunner) RemoveWorktree(ctx context.Context, bareRepo, worktreePath string) error
- type Runner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RealRunner ¶
RealRunner shells out to the git binary.
func (*RealRunner) AddWorktree ¶
func (r *RealRunner) AddWorktree(ctx context.Context, bareRepo, worktreePath, branch string) error
AddWorktree creates a worktree from a bare repo at the given path and branch.
func (*RealRunner) AddWorktreeNewBranch ¶
func (r *RealRunner) AddWorktreeNewBranch(ctx context.Context, bareRepo, worktreePath, newBranch, startPoint string) error
AddWorktreeNewBranch creates a worktree with a new branch starting from startPoint.
func (*RealRunner) BareClone ¶
func (r *RealRunner) BareClone(ctx context.Context, url, dest string) error
BareClone creates a bare clone of a repository.
func (*RealRunner) BranchExists ¶
BranchExists checks if a branch exists in the bare repo (local or remote ref).
func (*RealRunner) DefaultBranch ¶
DefaultBranch returns the default branch name (e.g. "main" or "master") for a bare repo.
func (*RealRunner) Fetch ¶
func (r *RealRunner) Fetch(ctx context.Context, repoPath string) error
Fetch fetches all refs in a bare repository.
func (*RealRunner) RemoveWorktree ¶
func (r *RealRunner) RemoveWorktree(ctx context.Context, bareRepo, worktreePath string) error
RemoveWorktree removes a worktree from a bare repo.
type Runner ¶
type Runner interface {
BareClone(ctx context.Context, url, dest string) error
Fetch(ctx context.Context, repoPath string) error
AddWorktree(ctx context.Context, bareRepo, worktreePath, branch string) error
AddWorktreeNewBranch(ctx context.Context, bareRepo, worktreePath, newBranch, startPoint string) error
RemoveWorktree(ctx context.Context, bareRepo, worktreePath string) error
BranchExists(ctx context.Context, bareRepo, branch string) (bool, error)
DefaultBranch(ctx context.Context, bareRepo string) (string, error)
}
Runner abstracts git operations for testability.