git

package
v0.65.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

FLUX V1 DEPRECATION NOTICE. https://github.com/weaveworks/eksctl/issues/2963

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsGitURL

func IsGitURL(rawURL string) bool

IsGitURL returns true if the argument matches the git url format

func RepoName

func RepoName(repoURL string) (string, error)

RepoName returns the name of the repository given its URL

func ValidatePrivateSSHKeyPath

func ValidatePrivateSSHKeyPath(privateSSHKeyPath string) error

ValidatePrivateSSHKeyPath validates the path to the (optional) private SSH key used to interact with the Git repository configured in this object.

func ValidateURL

func ValidateURL(url string) error

ValidateURL validates the provided Git URL.

Types

type Client

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

Client can perform git operations on the given directory

func NewGitClient

func NewGitClient(params ClientParams) *Client

NewGitClient returns a client that can perform git operations

func NewGitClientFromExecutor

func NewGitClientFromExecutor(executor executor.Executor) *Client

NewGitClientFromExecutor returns a client that can have an executor injected. Useful for testing

func (Client) Add

func (git Client) Add(files ...string) error

Add performs can perform a `git add` operation on the given file paths

func (*Client) CloneRepoInPath

func (git *Client) CloneRepoInPath(clonePath string, options CloneOptions) error

CloneRepoInPath behaves like CloneRepoInTmpDir but clones the repository in a specific directory which creates if needed

func (*Client) CloneRepoInTmpDir

func (git *Client) CloneRepoInTmpDir(tmpDirPrefix string, options CloneOptions) (string, error)

CloneRepoInTmpDir clones a repo specified in the gitURL in a temporary directory and checks out the specified branch

func (Client) Commit

func (git Client) Commit(message, user, email string) error

Commit makes a commit if there are staged changes

func (Client) DeleteLocalRepo

func (git Client) DeleteLocalRepo() error

DeleteLocalRepo deletes the local copy of a repository, including the directory

func (Client) DeleteRemoteBranch

func (git Client) DeleteRemoteBranch(branch string) error

func (Client) Push

func (git Client) Push() error

Push pushes the changes to the origin remote

func (*Client) WithDir

func (git *Client) WithDir(dir string)

WithDir directly sets the Client to use a directory, without havine to clone it

type ClientParams

type ClientParams struct {
	PrivateSSHKeyPath string
}

ClientParams groups the arguments to provide to create a new Git client.

type CloneOptions

type CloneOptions struct {
	URL       string
	Branch    string
	Bootstrap bool // create the branch if the repository is empty
}

CloneOptions are the options for cloning a Git repository

type TmpCloner

type TmpCloner interface {
	CloneRepoInTmpDir(cloneDirPrefix string, options CloneOptions) (string, error)
}

TmpCloner can clone git repositories in temporary directories

Jump to

Keyboard shortcuts

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