gitdir

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitDirectory

type GitDirectory struct {
	// contains filtered or unexported fields
}

GitDirectory is an implementation which keeps a directory

func NewGitDirectory

func NewGitDirectory(url string, opts GitDirectoryOptions) (*GitDirectory, error)

Create a new GitDirectory implementation

func (*GitDirectory) Cleanup

func (d *GitDirectory) Cleanup() error

Cleanup cancels running goroutines and operations, and removes the temporary clone directory

func (*GitDirectory) Dir

func (d *GitDirectory) Dir() string

func (*GitDirectory) Ready

func (d *GitDirectory) Ready() bool

Ready signals whether the git clone is ready to use

func (*GitDirectory) WaitForClone

func (d *GitDirectory) WaitForClone() error

WaitForClone waits until Ready() is true. In case Cleanup() is called before the repo was cloned, WaitForClone() returns an error.

type GitDirectoryOptions

type GitDirectoryOptions struct {
	// Options
	Branch   string        // default "master"
	Interval time.Duration // default 30s
	Timeout  time.Duration // default 1m

	// Authentication
	// For HTTPS basic auth. The password should be e.g. a GitHub access token
	Username, Password *string
	// For Git SSH protocol. This is the bytes of e.g. ~/.ssh/id_rsa, given that ~/.ssh/id_rsa.pub is
	// registered with and trusted by the Git provider.
	IdentityFileContent []byte

	// The file content (in bytes) of the known_hosts file to use for remote (e.g. GitHub) public key verification
	// If you want to use the default git CLI behavior, populate this byte slice with contents from
	// ioutil.ReadFile("~/.ssh/known_hosts").
	KnownHostsFileContent []byte
}

func (*GitDirectoryOptions) Default

func (o *GitDirectoryOptions) Default()

Jump to

Keyboard shortcuts

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