git

package
v0.0.4-rc0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: MPL-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoGitRepository = errors.New("no git repository")
	ErrNoStagedFiles   = errors.New("no staged files")
)

Functions

This section is empty.

Types

type Author

type Author struct {
	Name  string
	Email string
}

type Commit

type Commit struct {
	Author
	Hash    string
	Message string
}

type Git

type Git interface {
	Open(path string) (*gogit.Repository, error)
	Init(path, url, branch string) (bool, error)
	Clone(ctx context.Context, path, url, branch string) (bool, error)
	Write(path string, content []byte) error
	Commit(message Commit) (string, error)
	Push(ctx context.Context) error
	Status() (bool, error)
	Head() (string, error)
}

Git is an interface for basic Git operations on a single branch of a remote repository.

type GoGit

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

func New

func New(auth transport.AuthMethod) *GoGit

func (*GoGit) Clone

func (g *GoGit) Clone(ctx context.Context, path, url, branch string) (bool, error)

func (*GoGit) Commit

func (g *GoGit) Commit(message Commit) (string, error)

func (*GoGit) Head

func (g *GoGit) Head() (string, error)

func (*GoGit) Init

func (g *GoGit) Init(path, url, branch string) (bool, error)

func (*GoGit) Open

func (g *GoGit) Open(path string) (*gogit.Repository, error)

func (*GoGit) Push

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

func (*GoGit) Status

func (g *GoGit) Status() (bool, error)

func (*GoGit) Write

func (g *GoGit) Write(path string, content []byte) error

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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