git

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneOrPullURL

func CloneOrPullURL(ctx context.Context, url, destPath string, opts *CloneOptions) error

CloneOrPullURL clones a git repository if it doesn't exist at destPath, or pulls if it does.

func CloneURL

func CloneURL(ctx context.Context, url, destPath string, opts *CloneOptions) error

CloneURL clones a git repository from url to destPath.

func Exists

func Exists(path string) bool

Exists checks if a git repository exists at the given path.

func PullPath

func PullPath(ctx context.Context, repoPath string) error

PullPath pulls latest changes for the repository at repoPath.

Types

type CloneOptions

type CloneOptions struct {
	// Branch to checkout (default: default branch)
	Branch string
	// Depth for shallow clone (0 = full clone)
	Depth int
}

CloneOptions configures clone behavior.

type Repository

type Repository struct {
	// Owner is the repository owner (e.g., "aquaproj" for github.com/aquaproj/aqua-registry)
	Owner string
	// Name is the repository name (e.g., "aqua-registry")
	Name string
	// Host is the git host (default: "github.com")
	Host string
}

Repository represents a git repository with its metadata.

func NewRepository

func NewRepository(owner, name string) *Repository

NewRepository creates a new Repository with the given owner and name. Host defaults to "github.com".

func (*Repository) Clone

func (r *Repository) Clone(ctx context.Context, destPath string, opts *CloneOptions) error

Clone clones the repository to destPath.

func (*Repository) CloneOrPull

func (r *Repository) CloneOrPull(ctx context.Context, destPath string, opts *CloneOptions) error

CloneOrPull clones the repository if it doesn't exist at destPath, or pulls if it does.

func (*Repository) Pull

func (r *Repository) Pull(ctx context.Context, repoPath string) error

Pull pulls latest changes for the repository at repoPath.

func (*Repository) URL

func (r *Repository) URL() string

URL returns the HTTPS clone URL for the repository.

Jump to

Keyboard shortcuts

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