git

package
v1.1.0-rc7 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: Apache-2.0 Imports: 19 Imported by: 158

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCommitSHA added in v0.6.0

func IsCommitSHA(sha string) bool

IsCommitSHA returns whether or not a string is a 40 character SHA-1

func IsSSHURL added in v0.4.0

func IsSSHURL(url string) (bool, string)

IsSSHURL returns true if supplied URL is SSH URL

func IsTruncatedCommitSHA added in v0.9.0

func IsTruncatedCommitSHA(sha string) bool

IsTruncatedCommitSHA returns whether or not a string is a truncated SHA-1

func NormalizeGitURL

func NormalizeGitURL(repo string) string

NormalizeGitURL normalizes a git URL for purposes of comparison, as well as preventing redundant local clones (by normalizing various forms of a URL to a consistent location). Prefer using SameURL() over this function when possible. This algorithm may change over time and should not be considered stable from release to release

func SameURL added in v0.11.0

func SameURL(leftRepo, rightRepo string) bool

SameURL returns whether or not the two repository URLs are equivalent in location

func TestRepo

func TestRepo(repo, username, password string, sshPrivateKey string, insecureIgnoreHostKey bool) error

TestRepo tests if a repo exists and is accessible with the given credentials

Types

type Client

type Client interface {
	Root() string
	Init() error
	Fetch() error
	Checkout(revision string) error
	LsRemote(revision string) (string, error)
	LsFiles(path string) ([]string, error)
	CommitSHA() (string, error)
}

Client is a generic git client interface

type ClientFactory added in v0.4.0

type ClientFactory interface {
	NewClient(repoURL, path, username, password, sshPrivateKey string, insecureIgnoreHostKey bool) (Client, error)
}

ClientFactory is a factory of Git Clients Primarily used to support creation of mock git clients during unit testing

func NewFactory added in v0.4.0

func NewFactory() ClientFactory

type Creds added in v1.1.0

type Creds interface {
	Environ() (io.Closer, []string, error)
}

type HTTPSCreds added in v1.1.0

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

HTTPS creds implementation

func NewHTTPSCreds added in v1.1.0

func NewHTTPSCreds(username, password string) HTTPSCreds

func (HTTPSCreds) Environ added in v1.1.0

func (c HTTPSCreds) Environ() (io.Closer, []string, error)

type NopCloser added in v1.1.0

type NopCloser struct {
}

nop implementation

func (NopCloser) Close added in v1.1.0

func (c NopCloser) Close() error

type NopCreds added in v1.1.0

type NopCreds struct {
}

func (NopCreds) Environ added in v1.1.0

func (c NopCreds) Environ() (io.Closer, []string, error)

type SSHCreds added in v1.1.0

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

SSH implementation

func NewSSHCreds added in v1.1.0

func NewSSHCreds(sshPrivateKey string, insecureIgnoreHostKey bool) SSHCreds

func (SSHCreds) Environ added in v1.1.0

func (c SSHCreds) Environ() (io.Closer, []string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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