Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotRepository = fmt.Errorf("not a git repository") ErrInvalidConfig = fmt.Errorf("invalid configuration") )
Functions ¶
func IsRepository ¶
IsRepository checks for .git directory presence to verify repository status.
Types ¶
type Client ¶
func New ¶
New creates a git client with the provided command runner. Validates git is available to fail fast rather than on first operation.
func (Client) Clone ¶
func (c Client) Clone(ctx context.Context, cfg CloneConfig) error
Clone creates a new local copy of a remote repository. Parent directories are created automatically to avoid manual setup.
func (Client) CloneOrUpdate ¶
func (c Client) CloneOrUpdate(ctx context.Context, cfg CloneConfig) error
CloneOrUpdate ensures a repository exists and is up to date. Useful for idempotent operations where initial state is not important.
type CloneConfig ¶
type CloneConfig struct {
URL string // URL of the git repository.
Ref string // Branch, tag, or commit to checkout.
LocalPath string // LocalPath where to clone the repository
Depth int // Depth for shallow clone (0 = full clone)
}
CloneConfig configures repository cloning
func (CloneConfig) Validate ¶
func (cfg CloneConfig) Validate() error
Validate config before using it
Click to show internal directories.
Click to hide internal directories.