Documentation ¶
Index ¶
- func GetGitCommandEnvAndURL(repo, username, password string, sshPrivateKey string) (string, []string, error)
- func IsSshURL(url string) bool
- func NormalizeGitURL(repo string) string
- func TestRepo(repo, username, password string, sshPrivateKey string) error
- type Client
- type NativeGitClient
- func (m *NativeGitClient) Checkout(repoPath string, revision string) (string, error)
- func (m *NativeGitClient) CloneOrFetch(repo string, username string, password string, sshPrivateKey string, ...) error
- func (m *NativeGitClient) CommitSHA(repoPath string) (string, error)
- func (m *NativeGitClient) Init(repo string, repoPath string) error
- func (m *NativeGitClient) Reset(repoPath string) error
- func (m *NativeGitClient) SetCredentials(repo string, username string, password string, sshPrivateKey string, ...) error
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 NormalizeGitURL ¶
NormalizeGitURL normalizes a git URL for lookup and storage
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) CommitSHA(repoPath string) (string, error) Reset(repoPath string) error }
Client is a generic git client interface
func NewNativeGitClient ¶
NewNativeGitClient creates new instance of NativeGitClient
type NativeGitClient ¶
type NativeGitClient struct{}
NativeGitClient implements Client interface using git CLI
func (*NativeGitClient) Checkout ¶
func (m *NativeGitClient) Checkout(repoPath string, revision 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) CommitSHA ¶ added in v0.3.0
func (m *NativeGitClient) CommitSHA(repoPath string) (string, error)
CommitSHA returns current commit sha from `git rev-parse HEAD`
func (*NativeGitClient) Init ¶ added in v0.3.2
func (m *NativeGitClient) Init(repo string, repoPath string) error
Init initializes a local git repository and sets the remote origin
func (*NativeGitClient) Reset ¶
func (m *NativeGitClient) Reset(repoPath string) error
Reset resets local changes in a repository
func (*NativeGitClient) SetCredentials ¶ added in v0.3.2
func (m *NativeGitClient) SetCredentials(repo string, username string, password string, sshPrivateKey string, repoPath string) error
SetCredentials sets a local credentials file to connect to a remote git repository