git

package
v1.27.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package git provides a repository manager for basic git operations.

Index

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

func NewManager(backend git.Backend) *Manager

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) Type

func (m *Manager) Type() string

Type returns the repository type that this manager handles.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL