gitutil

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const RepoCacheDirEnv = "KPT_CACHE_DIR"

RepoCacheDirEnv is the name of the environment variable that controls the cache directory for remote repos. Defaults to UserHomeDir/.kpt/repos if unspecified.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitRunner

type GitRunner struct {
	// Dir is the directory the commands are run in.
	Dir string

	// RepoDir is the directory of the git repo containing the package
	RepoDir string

	// Stderr is where the git command Stderr is written
	Stderr *bytes.Buffer

	// Stdin is where the git command Stdin is read from
	Stdin *bytes.Buffer

	// Stdout is where the git command Stdout is written
	Stdout *bytes.Buffer

	// Verbose prints verbose command information
	Verbose bool
}

GitRunner runs git commands in a git repo.

func NewLocalGitRunner

func NewLocalGitRunner(pkg string) *GitRunner

NewLocalGitRunner returns a new GitRunner for a local package.

func NewUpstreamGitRunner

func NewUpstreamGitRunner(uri, dir string, required []string, optional []string) (*GitRunner, error)

NewUpstreamGitRunner returns a new GitRunner for an upstream package.

The upstream package repo will be fetched to a local cache directory under $HOME/.kpt and hard reset to origin/master. The refs will also be fetched so they are available locally.

func (*GitRunner) Run

func (g *GitRunner) Run(args ...string) error

Run runs a git command. Omit the 'git' part of the command.

Jump to

Keyboard shortcuts

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