git

package
v0.0.0-...-5f29aa1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RunCommand is mocked for tests.
	RunCommand = util.RunCmd
	// FilePathAbs is mocked for tests.
	FilePathAbs = filepath.Abs
)

Functions

func MockRunCommand

func MockRunCommand(f func() error) []string

MockRunCommand is sugar around MockRunCommandImpl, and returns a string with the arguments passed to RunCommand.

func MockRunCommandErrorsOn

func MockRunCommandErrorsOn(errCmd string, f func() error)

MockRunCommandErrorsOn is sugar around MockedRunCommandImpl and returns an error when invoked.

func MockRunCommandImpl

func MockRunCommandImpl(errString string, f func() error) []string

MockRunCommandImpl records and return the arguments passed to RunCommand as a string. An errString may be passed to force the command to fail with an error, if the command executed contains the errString. Useful, when mocking functions with multiple calls to RunCommand. This seems super wrong to have a test function living in the `git` package.

Types

type Git

type Git struct {
	Debug bool // Debug option set from CLI with debug state.
}

Git struct for adding methods.

func NewGit

func NewGit(debug bool) *Git

NewGit factory to create a new Git instance.

func (*Git) CheckoutIndex

func (g *Git) CheckoutIndex(repository repository.Repository) error

CheckoutIndex checkout Repository.Git to Repository.DstDir.

func (*Git) Clone

func (g *Git) Clone(repository repository.Repository) error

Clone clone Repository.Git to Repository.getCloneDir, and hard checkout to Repository.Version.

Jump to

Keyboard shortcuts

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