gitfs

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package gitfs implements a git cli based RCS backend. TODO(2.x) DEPRECATED and slated for removal in the 2.0.0 release.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 New

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

New 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) Compact

func (g *Git) Compact(ctx context.Context) error

Compact will run git gc

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) Delete

func (g *Git) Delete(ctx context.Context, name string) error

Delete removes the named entity

func (*Git) Exists

func (g *Git) Exists(ctx context.Context, name string) bool

Exists checks if the named entity exists

func (*Git) Fsck

func (g *Git) Fsck(ctx context.Context) error

Fsck checks the storage integrity

func (*Git) Get

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

Get retrieves the named content

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 https://git-scm.com/docs/git-log#_pretty_formats

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) IsDir

func (g *Git) IsDir(ctx context.Context, name string) bool

IsDir returns true if the named entity is a directory

func (*Git) IsInitialized

func (g *Git) IsInitialized() bool

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

func (*Git) List

func (g *Git) List(ctx context.Context, prefix string) ([]string, error)

List returns a list of all entities e.g. foo, far/bar baz/.bang directory separator are normalized using `/`

func (*Git) Name

func (g *Git) Name() string

Name returns git

func (*Git) Path

func (g *Git) Path() string

Path returns the ondisk path

func (*Git) Prune

func (g *Git) Prune(ctx context.Context, prefix string) error

Prune removes a named directory

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 http://blog.lost-theory.org/post/how-to-parse-git-log-output/ and https://git-scm.com/docs/git-log#_pretty_formats

func (*Git) Set

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

Set writes the given content

func (*Git) Status

func (g *Git) Status(ctx context.Context) ([]byte, error)

Status return the git status output

func (*Git) String

func (g *Git) String() string

String implements fmt.Stringer

func (*Git) Version

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

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

Jump to

Keyboard shortcuts

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