Documentation ¶
Index ¶
- Constants
- Variables
- type GitAuthor
- type GitClient
- func (c *GitClient) Add(_ context.Context, filePath string) error
- func (c *GitClient) AddAll(_ context.Context) error
- func (c *GitClient) AddAllAndCommit(ctx context.Context, msg string) error
- func (c *GitClient) AddAndCommit(ctx context.Context, filePath, msg string) error
- func (c *GitClient) Clone(ctx context.Context) error
- func (c *GitClient) Close() error
- func (c *GitClient) Commit(_ context.Context, msg string) error
- func (c *GitClient) GetLocalDirectory() string
- func (c *GitClient) Pull(ctx context.Context) error
- func (c *GitClient) Push(ctx context.Context) error
- type GitConfig
Constants ¶
View Source
const ( AuthTypeBasic = "basic" AuthTypeBasicSuffixUsername = ".basic.username" AuthTypeBasicSuffixPassword = ".basic.password" AuthTypeSSH = "ssh" AuthTypeSSHSuffixPrivateKey = ".ssh.privateKey" AuthTypeSSHSuffixPassword = ".ssh.password" AuthTypeSSHSuffixKnownHosts = ".ssh.known_hosts" )
Variables ¶
View Source
var ( ErrAuthorIsRequired = errors.New("author is required") ErrURLIsRequired = errors.New("URL is required") )
Functions ¶
This section is empty.
Types ¶
type GitClient ¶
type GitClient struct {
// contains filtered or unexported fields
}
GitClient is a small wrapper around go-git library methods. It provides clone/pull/push options as needed and has a simpler interface.
func NewGitClient ¶
NewGitClient creates a new go-git library wrapper
func (*GitClient) AddAllAndCommit ¶
AddAndCommit stages all changes an creates a commit
func (*GitClient) AddAndCommit ¶
AddAndCommit stages the given file an creates a commit
func (*GitClient) GetLocalDirectory ¶
GetLocalDirectory returns the directory where the repo is cloned to
type GitConfig ¶
type GitConfig struct { // The (possibly remote) repository URL to clone from. URL string `yaml:"url"` // Auth credentials, if required, to use with the remote repository. Auth transport.AuthMethod `yaml:"-"` // Fetch only ReferenceName if true. SingleBranch bool `yaml:"singleBranch"` // Limit fetching to the specified number of commits. Depth int `yaml:"depth"` // InsecureSkipTLS skips ssl verify if protocol is https InsecureSkipTLS bool `yaml:"insecureSkipTLS"` // CABundle specify additional ca bundle with system cert pool CABundle string `yaml:"caBundle"` // Remote branch to clone. If empty, uses HEAD. ReferenceName plumbing.ReferenceName `yaml:"referenceName"` // AuthType is the type of authentication AuthType string `yaml:"authType"` // EnvPrefix is the prefix for environment variables to configure EnvPrefix string `yaml:"envPrefix"` // Timeout is an optional field to specify a timeout for Git operations like cloning. Defaults to 60s. Timeout *time.Duration `yaml:"timeout"` // Author is the author of commits done by the client Author *GitAuthor `yaml:"author"` // contains filtered or unexported fields }
func NewGitConfig ¶
NewGitConfig creates a new configuration
Click to show internal directories.
Click to hide internal directories.