gitclient

package
v0.17.5 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitClient

type GitClient struct {
	Auth          transport.AuthMethod
	Client        GoGit
	RepoUrl       string
	RepoDirectory string
	Retrier       *retrier.Retrier
}

func New

func New(opts ...Opt) *GitClient

func (*GitClient) Add

func (g *GitClient) Add(filename string) error

func (*GitClient) Branch

func (g *GitClient) Branch(name string) error

func (*GitClient) Clone

func (g *GitClient) Clone(ctx context.Context) error

func (*GitClient) Commit

func (g *GitClient) Commit(message string) error

func (*GitClient) Init

func (g *GitClient) Init() error

func (*GitClient) Pull

func (g *GitClient) Pull(ctx context.Context, branch string) error

func (*GitClient) Push

func (g *GitClient) Push(ctx context.Context) error

func (*GitClient) Remove

func (g *GitClient) Remove(filename string) error

func (*GitClient) ValidateRemoteExists

func (g *GitClient) ValidateRemoteExists(ctx context.Context) error

type GoGit

type GoGit interface {
	AddGlob(f string, w *gogit.Worktree) error
	Checkout(w *gogit.Worktree, opts *gogit.CheckoutOptions) error
	Clone(ctx context.Context, dir string, repoUrl string, auth transport.AuthMethod) (*gogit.Repository, error)
	Commit(m string, sig *object.Signature, w *gogit.Worktree) (plumbing.Hash, error)
	CommitObject(r *gogit.Repository, h plumbing.Hash) (*object.Commit, error)
	Create(r *gogit.Repository, url string) (*gogit.Remote, error)
	CreateBranch(r *gogit.Repository, config *config.Branch) error
	Head(r *gogit.Repository) (*plumbing.Reference, error)
	NewRemote(url, remoteName string) *gogit.Remote
	Init(dir string) (*gogit.Repository, error)
	OpenDir(dir string) (*gogit.Repository, error)
	OpenWorktree(r *gogit.Repository) (*gogit.Worktree, error)
	PushWithContext(ctx context.Context, r *gogit.Repository, auth transport.AuthMethod) error
	PullWithContext(ctx context.Context, w *gogit.Worktree, auth transport.AuthMethod, ref plumbing.ReferenceName) error
	ListRemotes(r *gogit.Repository, auth transport.AuthMethod) ([]*plumbing.Reference, error)
	ListWithContext(ctx context.Context, r *gogit.Remote, auth transport.AuthMethod) ([]*plumbing.Reference, error)
	Remove(f string, w *gogit.Worktree) (plumbing.Hash, error)
	SetRepositoryReference(r *gogit.Repository, p *plumbing.Reference) error
}

type Opt

type Opt func(*GitClient)

func WithAuth

func WithAuth(auth transport.AuthMethod) Opt

func WithRepositoryDirectory

func WithRepositoryDirectory(repoDir string) Opt

func WithRepositoryUrl

func WithRepositoryUrl(repoUrl string) Opt

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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