Back to

Package cli

Latest Go to latest
Published: Jul 26, 2019 | License: MIT | Module:


Package Files

type Git

type Git struct {
	// contains filtered or unexported fields

Git is a cli based git backend

func Clone

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

Clone clones an existing git repo and returns a new cli based git backend configured for this clone repo

func Init

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

Init initializes this store's git repo

func Open

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

Open creates a new git cli based git backend

func (*Git) Add

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

Add adds the listed files to the git index

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(ctx context.Context, name string, args ...string) error

Cmd runs an git command

func (*Git) Commit

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

Commit creates a new git commit with the given commit message

func (*Git) ConfigGet

func (g *Git) ConfigGet(ctx context.Context, key string) (string, error)

ConfigGet returns a given config value

func (*Git) ConfigList

func (g *Git) ConfigList(ctx context.Context) (map[string]string, error)

ConfigList returns all git config settings

func (*Git) ConfigSet

func (g *Git) ConfigSet(ctx context.Context, key, value string) error

ConfigSet sets a local config value

func (*Git) GetRevision

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

GetRevision will return the content of any revision of the named entity see

func (*Git) HasStagedChanges

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

HasStagedChanges returns true if there are any staged changes which can be committed

func (*Git) InitConfig

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

InitConfig initialized and preparse the git config

func (*Git) IsInitialized

func (g *Git) IsInitialized() bool

IsInitialized returns true if this stores has an (probably) initialized .git folder

func (*Git) Name

func (g *Git) Name() string

Name returns git

func (*Git) Pull

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

Pull pulls from the git remote

func (*Git) Push

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

Push pushes to the git remote

func (*Git) PushPull

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

PushPull pushes the repo to it's origin. optional arguments: remote and branch

func (*Git) RemoveRemote

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

RemoveRemote removes a remote

func (*Git) Revisions

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

Revisions will list all available revisions of the named entity see and

func (*Git) Version

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

Version returns the git version as major, minor and patch level

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier