gitstore package - github.com/pusher/git-store - Go Packages

gitstore

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2018 License: Apache-2.0 Imports: 17 Imported by: 1

README

Git Store

Git abstraction layer written in Go for use in Kubernetes Controllers.

Communication

  • Found a bug? Please open an issue.
  • Have a feature request. Please open an issue.
  • If you want to contribute, please submit a pull request

Contributing

Please see our Contributing guidelines.

License

This project is licensed under Apache 2.0 and a copy of the license is available here.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncRepoCloner added in v0.2.0

type AsyncRepoCloner struct {
	Ready   bool
	RepoRef *RepoRef
	Repo    *Repo
	Error   error
}

AsyncRepoCloner represents an asynchronous repository cloner

func (*AsyncRepoCloner) Clone added in v0.2.0

func (rc *AsyncRepoCloner) Clone(auth transport.AuthMethod) <-chan struct{}

Clone starts an asynchronous clone of the requested repository and sets Ready to true when the repository is cloned successfully

type File

type File struct {
	Log GitLog
	// contains filtered or unexported fields
}

File represents a file content and log pair from the repository

func (*File) Contents

func (f *File) Contents() string

Contents returns the content of a file

type GitLog

type GitLog struct {
	Date   time.Time
	Hash   plumbing.Hash
	Author string
	Text   string
}

GitLog contains information about a commit from the git repository log

type Repo

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

Repo represents a git repository

func (*Repo) Checkout

func (r *Repo) Checkout(ref string) error

Checkout performs a Git checkout of the repository at the given reference

func (*Repo) Fetch

func (r *Repo) Fetch() error

Fetch performs a Git fetch of the repository

func (*Repo) GetAllFiles

func (r *Repo) GetAllFiles(subPath string, ignoreSymlinks bool) (map[string]*File, error)

GetAllFiles returns a map of Files. Each file is keyed in the map by it's path within the repository

func (*Repo) GetFile

func (r *Repo) GetFile(path string) (*File, error)

GetFile returns the contents of a file from within the repository

func (*Repo) LastUpdated added in v0.4.0

func (r *Repo) LastUpdated() (time.Time, error)

LastUpdated returns the timestamp that the current checkoud out reference was last updated

type RepoRef

type RepoRef struct {
	URL  string
	User string
	Pass string

	PrivateKey []byte
	// contains filtered or unexported fields
}

RepoRef contains information required to construct a Git Repository

func (*RepoRef) Validate

func (r *RepoRef) Validate() error

Validate will parse input URL and update private fields of the reference

type RepoStore

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

RepoStore holds git repositories for use by the controller

func NewRepoStore

func NewRepoStore() *RepoStore

NewRepoStore initializes a new RepoStore

func (*RepoStore) Get

func (rs *RepoStore) Get(ref *RepoRef) (*Repo, error)

Get retrieves a Repo from the RepoStore

func (*RepoStore) GetAsync added in v0.2.0

func (rs *RepoStore) GetAsync(ref *RepoRef) (*AsyncRepoCloner, <-chan struct{}, error)

GetAsync returns an asyncRepoCloner that will retrieve a Repo in the background

Jump to

Keyboard shortcuts

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