gitapi

package
v0.0.0-...-9be9164 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneRepository

func CloneRepository(remoteUrl, localPath, reference string) (*git.Repository, error)

func FindRepositories

func FindRepositories(dirs []string) ([]*git.Repository, error)

FindRepositories finds all git repositories in the given folders. Goes to one level deep.

func IsRepository

func IsRepository(path string) bool

func LoadGitRepo

func LoadGitRepo(path string) (*git.Repository, error)

func MirrorRepository

func MirrorRepository(remoteFetchUrl, remotePushUrl, reference string) error

Types

type Wrapper

type Wrapper interface {
	// AddRemote adds a remote to the repo.
	AddRemote(ctx context.Context, remoteName, remoteUrl string) error
	// Fetch fetches the remote.
	Fetch(ctx context.Context, remoteName string) error
	// CheckoutBranch checks out the given branch.
	CheckoutBranch(ctx context.Context, branchName string) error
	// CommitAll commits all changes.
	CommitAll(ctx context.Context, message string) error

	// Status returns the status of the repo.
	Status(ctx context.Context) error

	// CreateBranch creates a new branch.
	CreateBranch(ctx context.Context, branchName string) error
	// DeleteBranch deletes the given branch.
	DeleteBranch(ctx context.Context, branchName string) error
	// Push pushes the given branch to the remote.
	Push(ctx context.Context, remoteName, branchName string) error
	// RunCommand runs the given git command.
	RunCommand(ctx context.Context, command string, args []string) ([]byte, error)
}

func NewGitWrapper

func NewGitWrapper(path string) (Wrapper, error)

NewGitWrapper creates a new instance of Wrapper with the given repository.

Jump to

Keyboard shortcuts

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