Documentation
¶
Overview ¶
Package git provides a repository manager for basic git operations.
Index ¶
- Variables
- type Manager
- func (m *Manager) Clean(ctx context.Context, repoConfig *v2.RepositoryConfig, ...) error
- func (m *Manager) Clone(ctx context.Context, repoConfig *v2.RepositoryConfig, ...) error
- func (m *Manager) Status(ctx context.Context, repoConfig *v2.RepositoryConfig, ...) (*Status, error)
- func (m *Manager) Type() string
- func (m *Manager) Update(ctx context.Context, repoConfig *v2.RepositoryConfig, ...) error
- type Status
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotGitRepository is returned when a directory exists but is not a git repository. ErrNotGitRepository = errors.New("directory exists but is not a git repository") )
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager implements repository.Manager for basic git operations.
func NewManager ¶
NewManager creates a new git repository manager.
func (*Manager) Clean ¶
func (m *Manager) Clean(ctx context.Context, repoConfig *v2.RepositoryConfig, caproniConfig *v2.CaproniConfig) error
Clean removes the repository directory.
func (*Manager) Clone ¶
func (m *Manager) Clone(ctx context.Context, repoConfig *v2.RepositoryConfig, caproniConfig *v2.CaproniConfig) error
Clone clones the repository to the configured directory. If the directory already exists and is a valid git repository, this is a no-op.
func (*Manager) Status ¶
func (m *Manager) Status(ctx context.Context, repoConfig *v2.RepositoryConfig, caproniConfig *v2.CaproniConfig) (*Status, error)
Status returns the current status of the repository.
func (*Manager) Update ¶
func (m *Manager) Update(ctx context.Context, repoConfig *v2.RepositoryConfig, caproniConfig *v2.CaproniConfig) error
Update pulls the latest changes from the remote repository. If the directory doesn't exist, it clones the repository.
type Status ¶
type Status struct {
// Exists indicates if the directory exists.
Exists bool
// IsGit indicates if the directory is a git repository.
IsGit bool
// Branch is the current branch name.
Branch string
// Commit is the current commit SHA.
Commit string
// Dirty indicates if there are uncommitted changes.
Dirty bool
// Remote is the remote repository URL.
Remote string
}
Status represents the status of a git repository.
Click to show internal directories.
Click to hide internal directories.