Documentation ¶
Index ¶
- Variables
- type Author
- type Commit
- type Git
- type GoGit
- func (g *GoGit) Clone(ctx context.Context, path, url, branch string) (bool, error)
- func (g *GoGit) Commit(message Commit, filters ...func(string) bool) (string, error)
- func (g *GoGit) Head() (string, error)
- func (g *GoGit) Init(path, url, branch string) (bool, error)
- func (g *GoGit) Open(path string) (*gogit.Repository, error)
- func (g *GoGit) Push(ctx context.Context) error
- func (g *GoGit) Status() (bool, error)
- func (g *GoGit) Write(path string, content []byte) error
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 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, filters ...func(string) bool) (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 ¶
Clone clones a starting repository URL to a path, and checks out the provided branch name.
If the directory is successfully initialised, it returns true, otherwise it returns false.
func (*GoGit) Init ¶
Init initialises the directory at path with the remote and branch provided.
If the directory is successfully initialised it returns true, otherwise if the directory is already initialised, it returns false.
func (*GoGit) Open ¶
func (g *GoGit) Open(path string) (*gogit.Repository, error)
Open opens a git repository in the provided path, and returns a repository.
Click to show internal directories.
Click to hide internal directories.