Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface { Open() error Clone(co *git.CloneOptions) error Fetch(fo *git.FetchOptions) error Worktree() (*git.Worktree, error) Head() (*plumbing.Reference, error) ResolveRevision(plumbing.Revision) (*plumbing.Hash, error) IsOpen() bool SetFilesystem(billy.Filesystem) SetStorer(s storage.Storer) Close() }
Adapter is abstraction to SVC
func NewGitDriver ¶
NewGitDriver returns GitDriver with given storer and Filesystem
type ErrNoOpenRepo ¶
type ErrNoOpenRepo struct { }
ErrNoOpenRepo returned if repository is not opened by git driver
func (ErrNoOpenRepo) Error ¶
func (e ErrNoOpenRepo) Error() string
type ErrParseURL ¶
type ErrParseURL struct {
URL string
}
ErrParseURL returned if there is error when parsing URL
func (ErrParseURL) Error ¶
func (e ErrParseURL) Error() string
type GitDriver ¶
GitDriver implements repository interface
func (*GitDriver) Close ¶
func (g *GitDriver) Close()
Close sets repository to nil, IsOpen() function will return false now
func (*GitDriver) SetFilesystem ¶
func (g *GitDriver) SetFilesystem(fs billy.Filesystem)
SetFilesystem updates given Filesystem in GitDriver.Filesystem
type OptionsBuilder ¶
type OptionsBuilder interface { ToAuth() (transport.AuthMethod, error) ToCloneOptions(auth transport.AuthMethod) *git.CloneOptions ToCheckoutOptions() *git.CheckoutOptions ToFetchOptions(auth transport.AuthMethod) *git.FetchOptions URL() string }
OptionsBuilder interface provides specification for a repository implementation
type Repository ¶
type Repository struct { Driver Adapter OptionsBuilder Name string }
Repository container holds Filesystem, spec and open repository object Abstracts git repository and allows for easy cloning, checkout and update of git repos
func NewRepository ¶
func NewRepository(basePath string, builder OptionsBuilder) (*Repository, error)
NewRepository create repository object, with real filesystem on disk basePath is used to calculate final path where to clone/open the repository
func (*Repository) Checkout ¶
func (repo *Repository) Checkout() error
Checkout git repository, ToCheckoutOptions method will be used go get CheckoutOptions
func (*Repository) Download ¶
func (repo *Repository) Download(noCheckout bool) error
Download will clone and checkout repository based on auth and checkout fields of the Repository object If repository is already cloned, it will be opened and checked out to configured hash,branch,tag etc... no remotes will be modified in this case, also no refs will be updated. enforce parameter is used to simulate git reset --hard option. If you want to enforce state of the repository, please delete current git repository before downloading.
func (*Repository) Update ¶
func (repo *Repository) Update() error
Update fetches new refs, and checkout according to checkout options