git

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

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)

GetGitCommandOptions returns URL and env options for git operation

func IsSshURL

func IsSshURL(url string) bool

IsSshURL returns true is 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 {
	CloneOrFetch(url string, username string, password string, sshPrivateKey string, repoPath string) error
	Checkout(repoPath string, sha string) (string, error)
	Reset(repoPath string) error
}

Client is a generic git client interface

func NewNativeGitClient

func NewNativeGitClient() (Client, error)

NewNativeGitClient creates new instance of NativeGitClient

type NativeGitClient

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

NativeGitClient implements Client interface using git CLI

func (*NativeGitClient) Checkout

func (m *NativeGitClient) Checkout(repoPath string, sha string) (string, error)

Checkout checkout specified git sha

func (*NativeGitClient) CloneOrFetch

func (m *NativeGitClient) CloneOrFetch(repo string, username string, password string, sshPrivateKey string, repoPath string) error

CloneOrFetch either clone or fetch repository into specified directory path.

func (*NativeGitClient) Reset

func (m *NativeGitClient) Reset(repoPath string) error

Reset resets local changes

Directories

Path Synopsis
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0

Jump to

Keyboard shortcuts

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