git

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2018 License: Apache-2.0 Imports: 10 Imported by: 148

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGitCommandEnvAndURL

func GetGitCommandEnvAndURL(repo, username, password string, sshPrivateKey string) (string, []string, error)

GetGitCommandEnvAndURL returns URL and env options for git operation

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

IsSSHURL returns true if supplied URL is SSH URL

func NormalizeGitURL

func NormalizeGitURL(repo string) string

NormalizeGitURL normalizes a git URL for lookup and storage

func TestRepo

func TestRepo(repo, username, password string, sshPrivateKey string) 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)
	Reset() 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) Client
}

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

Jump to

Keyboard shortcuts

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