Documentation
¶
Index ¶
- type AddFilesCommand
- type CheckoutBranchCommand
- type CommitChangesCommand
- type CreateBranchCommand
- type GitCommand
- type GitContext
- func (ctx *GitContext) CheckIfRepoExists() (bool, error)
- func (ctx *GitContext) Cleanup() error
- func (ctx *GitContext) ExecuteCommand(cmd GitCommand) error
- func (ctx *GitContext) ExecuteCommandChain(cmds []GitCommand) error
- func (ctx *GitContext) GetHash() (string, error)
- func (ctx *GitContext) GetReferenceName() (string, error)
- func (ctx *GitContext) GetTargetReferenceName() (string, error)
- func (ctx *GitContext) WithBasicAuth(username, password string) *GitContext
- func (ctx *GitContext) WithCABundle(caBundle []byte) *GitContext
- func (ctx *GitContext) WithInsecureSkipTLS(insecureSkipTLS bool) *GitContext
- func (ctx *GitContext) WithProxy(proxyURL, proxyUsername, proxyPassword string) *GitContext
- func (ctx *GitContext) WithReferenceName(referenceName string) *GitContext
- func (ctx *GitContext) WithRemote(remote RemoteInterface) *GitContext
- func (ctx *GitContext) WithRemoteName(remoteName string) *GitContext
- func (ctx *GitContext) WithSingleBranch(singleBranch bool) *GitContext
- func (ctx *GitContext) WithTempDir(tempDir string) *GitContext
- func (ctx *GitContext) WithToken(token string) *GitContext
- type GitHash
- type GitInterface
- type MergeBranchCommand
- type PullChangesCommand
- type PushChangesCommand
- type ReadFileCommand
- type RemoteInterface
- type RemoveFileCommand
- type WriteFileCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddFilesCommand ¶
type AddFilesCommand struct {
Files []string
}
AddFilesCommand is a command that adds files to the git index.
type CheckoutBranchCommand ¶
type CheckoutBranchCommand struct {
Branch string
}
CheckoutBranchCommand is a command that checks out a branch in the git repository.
type CommitChangesCommand ¶
CommitChangesCommand is a command that commits changes to the git repository.
type CreateBranchCommand ¶
type CreateBranchCommand struct {
Branch string
}
CreateBranchCommand is a command that creates a new branch in the git repository.
type GitCommand ¶
type GitCommand interface {
// contains filtered or unexported methods
}
GitCommand is an interface that defines a method to execute a command on a git repository.
type GitContext ¶
type GitContext struct {
// contains filtered or unexported fields
}
GitContext is a struct that contains the context for a git repository.
func InitNewRepository ¶
func InitNewRepository(repoName string) (*GitContext, error)
InitNewRepository initializes a new local GitContext with the given repository name.
func NewRepository ¶
func NewRepository(repoURL string) *GitContext
NewRepository creates a new GitContext with the given repository URL and authentication method.
func (*GitContext) CheckIfRepoExists ¶ added in v0.2.68
func (ctx *GitContext) CheckIfRepoExists() (bool, error)
func (*GitContext) Cleanup ¶
func (ctx *GitContext) Cleanup() error
Cleanup removes the temporary directory of the GitContext. This should be called after the GitContext is no longer needed. Use defer ctx.Cleanup() after creating a GitContext.
func (*GitContext) ExecuteCommand ¶
func (ctx *GitContext) ExecuteCommand(cmd GitCommand) error
ExecuteCommand executes the given GitCommand on the GitContext.
func (*GitContext) ExecuteCommandChain ¶
func (ctx *GitContext) ExecuteCommandChain(cmds []GitCommand) error
ExecuteCommandChain executes the given chain of GitCommands on the GitContext. If any of the commands fail, the chain is stopped and the error is returned. Otherwise, nil is returned. The commands are executed in the order they are given. When command fails the chain is stopped, but previously executed commands are not reverted.
func (*GitContext) GetHash ¶
func (ctx *GitContext) GetHash() (string, error)
func (*GitContext) GetReferenceName ¶
func (ctx *GitContext) GetReferenceName() (string, error)
func (*GitContext) GetTargetReferenceName ¶
func (ctx *GitContext) GetTargetReferenceName() (string, error)
func (*GitContext) WithBasicAuth ¶
func (ctx *GitContext) WithBasicAuth(username, password string) *GitContext
WithBasicAuth sets the username and password for the GitContext.
func (*GitContext) WithCABundle ¶
func (ctx *GitContext) WithCABundle(caBundle []byte) *GitContext
WithCABundle sets the CA bytes for the GitContext. CA will be used as the certificate of trust for the TLS connection.
func (*GitContext) WithInsecureSkipTLS ¶
func (ctx *GitContext) WithInsecureSkipTLS(insecureSkipTLS bool) *GitContext
WithInsecureSkipTLS sets the insecure skip TLS flag for the GitContext. Default is false. If true, check of the certificate is skipped, not recommended in production.
func (*GitContext) WithProxy ¶
func (ctx *GitContext) WithProxy(proxyURL, proxyUsername, proxyPassword string) *GitContext
WithProxy sets the proxy URL, username, and password for the GitContext.
func (*GitContext) WithReferenceName ¶
func (ctx *GitContext) WithReferenceName(referenceName string) *GitContext
WithReferenceName sets the reference name for the GitContext.
func (*GitContext) WithRemote ¶ added in v0.2.68
func (ctx *GitContext) WithRemote(remote RemoteInterface) *GitContext
func (*GitContext) WithRemoteName ¶
func (ctx *GitContext) WithRemoteName(remoteName string) *GitContext
WithRemoteName sets the remote name for the GitContext. Default is "origin".
func (*GitContext) WithSingleBranch ¶
func (ctx *GitContext) WithSingleBranch(singleBranch bool) *GitContext
WithSingleBranch sets the single branch flag for the GitContext. Default is false. If true, only the WithReferenceName set branch is cloned.
func (*GitContext) WithTempDir ¶
func (ctx *GitContext) WithTempDir(tempDir string) *GitContext
WithTempDir sets the temporary directory for the GitContext. Default is the OS temporary directory.
func (*GitContext) WithToken ¶
func (ctx *GitContext) WithToken(token string) *GitContext
WithToken sets the token for the GitContext.
type GitInterface ¶ added in v0.2.67
type MergeBranchCommand ¶
MergeBranchCommand is a command that merges a branch into another branch in the git repository.
type PullChangesCommand ¶
PullChangesCommand is a command that pulls changes from a remote git repository.
type PushChangesCommand ¶
PushChangesCommand is a command that pushes changes to a remote git repository.
type ReadFileCommand ¶
ReadFileCommand is a command that reads a file from a git repository.
type RemoteInterface ¶ added in v0.2.68
type RemoveFileCommand ¶
type RemoveFileCommand struct {
FilePath string
}
RemoveFileCommand is a command that removes a file from a git repository.
type WriteFileCommand ¶
WriteFileCommand is a command that writes a file to a git repository.