vcs

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLimitExceeded = errors.New("repo size limit exceeded")

ErrLimitExceeded is the error returned when the storage limit has been exceeded (usually during git clone)

Functions

func GetClonedPath

func GetClonedPath(vcsurl, destDirName string, overwrite bool) (string, error)

GetClonedPath takes a vcsurl and a folder name, performs a clone with the appropriate VCS, and then returns the file system and remote paths. If the VCS is not supported, the returned path will be an empty string.

func IsRemotePath

func IsRemotePath(input string) bool

IsRemotePath returns if the provided input is a remote path or not

func Limit added in v0.3.12

func Limit(s storage.Storer, n int64) storage.Storer

Limit returns a git.Storer limited to the specified number of bytes.

func PushVCSRepo

func PushVCSRepo(remotePath, folderName string) error

PushVCSRepo commits and pushes the changes in the provide vcs remote path

func SetMaxRepoCloneSize added in v0.3.12

func SetMaxRepoCloneSize(size int64)

SetMaxRepoCloneSize sets the maximum size (in bytes) for cloning a repo

Types

type FailedVCSPush

type FailedVCSPush struct {
	VCSPath string
	Err     error
}

FailedVCSPush is the error when push is failed

func (*FailedVCSPush) Error

func (e *FailedVCSPush) Error() string

Error returns the error message for failed push

type GitVCSRepo

type GitVCSRepo struct {
	InputURL       string
	URL            string
	Branch         string
	Tag            string
	CommitHash     string
	PathWithinRepo string
	GitRepository  *git.Repository
	GitRepoPath    string
}

GitVCSRepo stores git repo config

func (*GitVCSRepo) Clone

func (gvcsrepo *GitVCSRepo) Clone(cloneOptions VCSCloneOptions) (string, error)

Clone clones a git repository with the given commit depth and path where it is to be cloned and returns the final path inside the repo

type Limited added in v0.3.12

type Limited struct {
	storage.Storer
	N atomic.Int64
}

Limited wraps git.Storer to limit the number of bytes that can be stored.

func (*Limited) Module added in v0.3.12

func (s *Limited) Module(name string) (storage.Storer, error)

Module is a Storer interface method that is used to get the working tree for a repo sub-module

func (*Limited) SetEncodedObject added in v0.3.12

func (s *Limited) SetEncodedObject(obj plumbing.EncodedObject) (plumbing.Hash, error)

SetEncodedObject is a Storer interface method that is used to store an object

type NoCompatibleVCSFound

type NoCompatibleVCSFound struct {
	URLInput string
}

NoCompatibleVCSFound is the error when no VCS is found suitable for the given remote input path

func (*NoCompatibleVCSFound) Error

func (e *NoCompatibleVCSFound) Error() string

Error returns the error message for no valid vcs is found

type VCS

type VCS interface {
	Clone(VCSCloneOptions) (string, error)
}

VCS defines interface for version control system

func GetVCSRepo

func GetVCSRepo(vcsurl string) (VCS, error)

GetVCSRepo extracts information from the given vcsurl and returns a relevant vcs repo struct

type VCSCloneOptions

type VCSCloneOptions struct {
	CommitDepth          int
	Overwrite            bool
	MaxSize              int64
	CloneDestinationPath string
}

VCSCloneOptions stores version control system clone options

Jump to

Keyboard shortcuts

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