Documentation ¶
Index ¶
- func AddFile(repositoryPath, path string) error
- func CheckoutBranch(repositoryPath, branch string) error
- func CheckoutCommit(repositoryPath string, commit gitplumbing.Hash) error
- func Commit(repositoryPath, message string) (gitplumbing.Hash, error)
- func CreateBranch(repositoryPath, branch string, commit gitplumbing.Hash) error
- func GetBranchHeadCommit(repositoryPath, branch string) (gitplumbing.Hash, error)
- func Init(path string) error
- func Tag(repositoryPath string, commit gitplumbing.Hash, name string) error
- func WriteAndAddFile(repositoryPath, path string, contents []byte, perm os.FileMode) error
- func WriteAndCommitFile(repositoryPath string, path string, contents []byte, perm os.FileMode, ...) (gitplumbing.Hash, error)
- func WriteFile(repositoryPath, path string, contents []byte, perm os.FileMode) error
- type CloneError
- type CommitReference
- type Context
- type FetchError
- type FileReference
- type Options
- type Reference
- type Resolver
- func (r *Resolver) Checkout(ctx *Context, ref *Reference) error
- func (r *Resolver) Clone(ctx *Context) (*git.Repository, error)
- func (r *Resolver) Fetch(ctx *Context) error
- func (r *Resolver) FileContents(ctx *Context, ref *Reference, fileName string) ([]byte, error)
- func (r *Resolver) GetCommit(ctx *Context, ref *Reference) (*gitplumbingobject.Commit, error)
- func (r *Resolver) IsValidRepositoryURI(uri string) bool
- func (r *Resolver) RepositoryPath(url string) string
- func (r *Resolver) Tags(ctx *Context) ([]string, error)
- func (r *Resolver) Versions(ctx *Context, semverRange semver.Range) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckoutBranch ¶
func CheckoutCommit ¶
func CheckoutCommit(repositoryPath string, commit gitplumbing.Hash) error
func Commit ¶
func Commit(repositoryPath, message string) (gitplumbing.Hash, error)
Commit attempts to commit the repository.
func CreateBranch ¶
func CreateBranch(repositoryPath, branch string, commit gitplumbing.Hash) error
func GetBranchHeadCommit ¶
func GetBranchHeadCommit(repositoryPath, branch string) (gitplumbing.Hash, error)
func Tag ¶
func Tag(repositoryPath string, commit gitplumbing.Hash, name string) error
Tag attempts to create a lightweight tag referencing the hash.
func WriteAndAddFile ¶
func WriteAndCommitFile ¶
Types ¶
type CloneError ¶
type CloneError struct {
// contains filtered or unexported fields
}
CloneError is returned when there is an error cloning a repository.
func (*CloneError) Error ¶
func (e *CloneError) Error() string
type CommitReference ¶
type FetchError ¶
type FetchError struct {
// contains filtered or unexported fields
}
FetchError is returned when there is an error fetching.
func (*FetchError) Error ¶
func (e *FetchError) Error() string
type FileReference ¶
type FileReference struct { CommitReference File string `json:"file"` }
type Options ¶
type Options struct {
SSHKey []byte
}
Options contains information about how to complete the operation.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver provides utility methods for manipulating git repositories under a specific working directory on the filesystem.
func (*Resolver) Checkout ¶
Checkout will clone and fetch, then attempt to check out the ref specified in the context.
func (*Resolver) Clone ¶
Clone will open the repository and return it If the repository specified in the Context has already been cloned, otherwise it will attempt to clone the repository and on success return the cloned repository
func (*Resolver) Fetch ¶
Fetch will clone a repository if necessary, then attempt to fetch the repository from origin
func (*Resolver) FileContents ¶
FileContents will clone, fetch, and checkout the proper reference, and if successful will attempt to return the contents of the file at fileName.
func (*Resolver) GetCommit ¶
Commit will parse the Ref (i.e. #<ref>) from the git uri and determine if its a branch/tag/commit. Returns the actual commit object for that ref. Defaults to HEAD. GetCommit will first fetch from origin.
func (*Resolver) IsValidRepositoryURI ¶
IsValidRepositoryURI returns a boolean indicating whether or not the uri is a valid git repository.