gogit

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Stdout is exported for mocking / redirecting
	Stdout io.Writer = os.Stdout
)

Functions

This section is empty.

Types

type Git

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

Git is a go-git.v4 based git client

func Clone

func Clone(ctx context.Context, repo, path string) (*Git, error)

Clone tries to clone an git repo from a remote

func Init

func Init(ctx context.Context, path string) (*Git, error)

Init creates a new git repo on disk

func Open

func Open(path string) (*Git, error)

Open tries to open an existing git repo on disk

func (*Git) Add

func (g *Git) Add(ctx context.Context, files ...string) error

Add adds any number of files to git

func (*Git) AddRemote

func (g *Git) AddRemote(ctx context.Context, remote, url string) error

AddRemote adds a new remote

func (*Git) Cmd

func (g *Git) Cmd(context.Context, string, ...string) error

Cmd is not supported and will go away eventually

func (*Git) Commit

func (g *Git) Commit(ctx context.Context, msg string) error

Commit creates a new commit

func (*Git) GetRevision

func (g *Git) GetRevision(context.Context, string, string) ([]byte, error)

GetRevision is not implemented

func (*Git) HasStagedChanges

func (g *Git) HasStagedChanges(ctx context.Context) bool

HasStagedChanges retures true if there are changes which can be committed

func (*Git) InitConfig

func (g *Git) InitConfig(context.Context, string, string) error

InitConfig is not yet implemented

func (*Git) IsInitialized

func (g *Git) IsInitialized() bool

IsInitialized returns true if this is a valid repo

func (*Git) Name

func (g *Git) Name() string

Name returns go-git

func (*Git) Pull

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

Pull will pull any changes

func (*Git) Push

func (g *Git) Push(ctx context.Context, remote, branch string) error

Push will push any changes to the remote

func (*Git) PushPull

func (g *Git) PushPull(ctx context.Context, op, remote, branch string) error

PushPull will first pull from the remote and then push any changes

func (*Git) RemoveRemote

func (g *Git) RemoveRemote(ctx context.Context, remote string) error

RemoveRemote removes a remote

func (*Git) Revisions

func (g *Git) Revisions(context.Context, string) ([]backend.Revision, error)

Revisions is not implemented

func (*Git) Version

func (g *Git) Version(context.Context) semver.Version

Version just returns the (static) go-git version

Jump to

Keyboard shortcuts

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