Versions in this module Expand all Collapse all v1 v1.27.1 Mar 19, 2026 v1.27.0 Mar 19, 2026 Changes in this version + var ErrDirectoryNotGitRepo = errors.New("directory exists but is not a git repository") + var ErrInvalidCloneStrategy = errors.New("invalid clone strategy") + var ErrNoGitOutput = errors.New("no output from git command") + type Backend interface + Clone func(ctx context.Context, repoURL string, directory string) error + DetectState func(ctx context.Context, directory string, configuredURL string) (*RepositoryState, error) + EnsureCloned func(ctx context.Context, repoURL string, directory string, cloneStrategy string) error + Fetch func(ctx context.Context, directory string) error + GetCommitCounts func(ctx context.Context, directory string) (behind, ahead int, err error) + GetCurrentBranch func(ctx context.Context, directory string) (string, error) + GetDefaultBranch func(ctx context.Context, directory string, repoURL string) (string, error) + GetRevision func(ctx context.Context, directory string) (string, error) + GetStatus func(ctx context.Context, directory string) (*Status, error) + GetTrackingBranch func(ctx context.Context, directory string) (string, error) + IsDetached func(ctx context.Context, directory string) (bool, error) + IsGitRepository func(ctx context.Context, directory string) (bool, error) + Pull func(ctx context.Context, directory string) error + PullFFOnly func(ctx context.Context, directory string) error + StashPush func(ctx context.Context, directory string, message string) error + type Client struct + func NewClient(executor executor.CommandRunner) *Client + func (b *Client) Clone(ctx context.Context, repoURL string, directory string) error + func (b *Client) DetectState(ctx context.Context, directory string, configuredURL string) (*RepositoryState, error) + func (b *Client) EnsureCloned(ctx context.Context, repoURL string, directory string, cloneStrategy string) error + func (b *Client) Fetch(ctx context.Context, directory string) error + func (b *Client) GetCommitCounts(ctx context.Context, directory string) (behind, ahead int, err error) + func (b *Client) GetCurrentBranch(ctx context.Context, directory string) (string, error) + func (b *Client) GetDefaultBranch(ctx context.Context, directory string, repoURL string) (string, error) + func (b *Client) GetRevision(ctx context.Context, directory string) (string, error) + func (b *Client) GetStatus(ctx context.Context, directory string) (*Status, error) + func (b *Client) GetTrackingBranch(ctx context.Context, directory string) (string, error) + func (b *Client) HasUncommittedChanges(ctx context.Context, directory string) (bool, error) + func (b *Client) IsDetached(ctx context.Context, directory string) (bool, error) + func (b *Client) IsGitRepository(ctx context.Context, directory string) (bool, error) + func (b *Client) Pull(ctx context.Context, directory string) error + func (b *Client) PullFFOnly(ctx context.Context, directory string) error + func (b *Client) StashPush(ctx context.Context, directory string, message string) error + type RepositoryState struct + CommitsAhead int + CommitsBehind int + CurrentBranch string + DefaultBranch string + Exists bool + HasUncommitted bool + HasUnpushed bool + IsDetached bool + IsGitRepo bool + LastError error + RemoteMatches bool + RemoteURL string + TrackingBranch string + type Status struct + Branch string + HasUncommittedChanges bool + RemoteURL string + Revision string