git

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotGitRepo when target isn't a git repository.
	ErrNotGitRepo = errors.New("not a git repository")

	// ErrRemoteOperationFailed when remote git repository operation failed.
	ErrRemoteOperationFailed = errors.New("remote git operation failed")

	// ErrLocalOperationFailed when local git repository operation failed.
	ErrLocalOperationFailed = errors.New("local git operation failed")
)
View Source
var (
	// ErrInvalidAddress when an invalid address is provided to ParseAddress func.
	ErrInvalidAddress = errors.New("invalid address")
)

Functions

This section is empty.

Types

type Address

type Address struct {
	Type     AddressType
	Protocol string
	User     string
	Host     string
	Path     string
	Ext      string
}

Address represents a GIT remote address.

func ParseAddress

func ParseAddress(address string) (*Address, error)

ParseAddress of a GIT remote URL.

type AddressType

type AddressType int

AddressType is a type of GIT remote address.

const (
	// AddressTypeGit is a type of GIT address.
	AddressTypeGit AddressType = iota
	// AddressTypeHTTP is a type of HTTP address.
	AddressTypeHTTP
)

type Project

type Project struct {
	config.Project
	// contains filtered or unexported fields
}

Project is a project with Git information attached.

func NewProject

func NewProject(project config.Project, state state.State) (Project, error)

NewProject creates a new Project from regular config.Project.

func (Project) Repository

func (p Project) Repository() *Repository

Repository returns a Git repository implementation.

type Repository

type Repository struct {
	*gitv5.Repository
	config.Project
	context.Context
}

Repository is an implementation of git repository using Golang library.

func (Repository) Checkout

func (r Repository) Checkout(remote git.Remote, branch string) git.Checkout

func (Repository) CommitChanges

func (r Repository) CommitChanges(message string) (*object.Commit, error)

func (Repository) DeleteBranch

func (r Repository) DeleteBranch(branch string) error

func (Repository) Fetch

func (r Repository) Fetch(remote git.Remote) error

func (Repository) ListRemote

func (r Repository) ListRemote(remote git.Remote) ([]*plumbing.Reference, error)

func (Repository) Merge added in v0.3.0

func (r Repository) Merge(remote *git.Remote, branch string) error

func (Repository) Push

func (r Repository) Push(remote git.Remote, refname plumbing.ReferenceName) error

func (Repository) Remote

func (r Repository) Remote(name string) (string, error)

Jump to

Keyboard shortcuts

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