Documentation ¶
Index ¶
- Constants
- Variables
- func CopyWithCallback(writer io.Writer, reader io.Reader, totalSize int64, cb CopyCallback) (int64, error)
- func DoHTTP(req *http.Request) (*http.Response, error)
- func EncodePointer(writer io.Writer, pointer *Pointer) (int, error)
- func Environ() []string
- func InRepo() bool
- func InstallFilters() error
- func InstallHooks(force bool) error
- func LocalMediaPath(sha string) (string, error)
- func LogHttpStats()
- func LogTransfer(key string, res *http.Response)
- func NewUploadable(oid, filename string, index, totalFiles int) (*Uploadable, *WrappedError)
- func ObjectUrl(endpoint Endpoint, oid string) (*url.URL, error)
- func PointerClean(reader io.Reader, size int64, cb CopyCallback) (*cleanedAsset, error)
- func PointerSmudge(writer io.Writer, ptr *Pointer, workingfile string, cb CopyCallback) error
- func PointerSmudgeObject(ptr *Pointer, obj *objectResource, cb CopyCallback) error
- func ResetTempDir() error
- func Stack() []byte
- func TempFile(prefix string) (*os.File, error)
- type CallbackReader
- type CleanedPointerError
- type ClientError
- type Configuration
- func (c *Configuration) BatchTransfer() bool
- func (c *Configuration) ConcurrentTransfers() int
- func (c *Configuration) Endpoint() Endpoint
- func (c *Configuration) Getenv(key string) string
- func (c *Configuration) GetenvBool(key string, def bool) bool
- func (c *Configuration) GitConfig(key string) (string, bool)
- func (c *Configuration) HttpClient() *HttpClient
- func (c *Configuration) ObjectUrl(oid string) (*url.URL, error)
- func (c *Configuration) RemoteEndpoint(remote string) Endpoint
- func (c *Configuration) Remotes() []string
- func (c *Configuration) SetConfig(key, value string)
- type CopyCallback
- type CredentialCmd
- type Creds
- type Downloadable
- func (d *Downloadable) Check() (*objectResource, *WrappedError)
- func (d *Downloadable) Name() string
- func (d *Downloadable) Object() *objectResource
- func (d *Downloadable) Oid() string
- func (d *Downloadable) SetObject(o *objectResource)
- func (d *Downloadable) Size() int64
- func (d *Downloadable) Transfer(cb CopyCallback) *WrappedError
- type Endpoint
- type HookExists
- type HttpClient
- type Pointer
- type SmudgeError
- type TransferQueue
- type Transferable
- type Uploadable
- func (u *Uploadable) Check() (*objectResource, *WrappedError)
- func (u *Uploadable) Name() string
- func (u *Uploadable) Object() *objectResource
- func (u *Uploadable) Oid() string
- func (u *Uploadable) SetObject(o *objectResource)
- func (u *Uploadable) Size() int64
- func (u *Uploadable) Transfer(cb CopyCallback) *WrappedError
- type WrappedError
- func Batch(objects []*objectResource) ([]*objectResource, *WrappedError)
- func Download(oid string) (io.ReadCloser, int64, *WrappedError)
- func DownloadCheck(oid string) (*objectResource, *WrappedError)
- func DownloadObject(obj *objectResource) (io.ReadCloser, int64, *WrappedError)
- func Error(err error) *WrappedError
- func Errorf(err error, format string, args ...interface{}) *WrappedError
- func UploadCheck(oidPath string) (*objectResource, *WrappedError)
- func UploadObject(o *objectResource, cb CopyCallback) *WrappedError
- func (e *WrappedError) Context() map[string]string
- func (e *WrappedError) Del(key string)
- func (e *WrappedError) Error() string
- func (e *WrappedError) Errorf(format string, args ...interface{})
- func (e *WrappedError) Get(key string) string
- func (e *WrappedError) InnerError() string
- func (e *WrappedError) Set(key, value string)
- func (e *WrappedError) Stack() []byte
- type WrappedPointer
Constants ¶
const EndpointUrlUnknown = "<unknown>"
const Version = "0.5.2"
Variables ¶
var ( LargeSizeThreshold = 5 * 1024 * 1024 TempDir = filepath.Join(os.TempDir(), "git-lfs") UserAgent string LocalWorkingDir string LocalGitDir string LocalMediaDir string LocalLogDir string )
var (
Config = NewConfig()
)
var (
NotInARepositoryError = errors.New("Not in a repository")
)
Functions ¶
func CopyWithCallback ¶
func EncodePointer ¶ added in v0.5.1
func InstallFilters ¶
func InstallFilters() error
func InstallHooks ¶
func LocalMediaPath ¶
func LogHttpStats ¶ added in v0.5.2
func LogHttpStats()
LogHttpStats is intended to be called after all HTTP operations for the commmand have finished. It dumps k/v logs, one line per transfer into a log file with the current timestamp.
func LogTransfer ¶ added in v0.5.2
func NewUploadable ¶ added in v0.5.1
func NewUploadable(oid, filename string, index, totalFiles int) (*Uploadable, *WrappedError)
NewUploadable builds the Uploadable from the given information.
func PointerClean ¶ added in v0.5.1
func PointerClean(reader io.Reader, size int64, cb CopyCallback) (*cleanedAsset, error)
func PointerSmudge ¶ added in v0.5.1
func PointerSmudgeObject ¶ added in v0.5.2
func PointerSmudgeObject(ptr *Pointer, obj *objectResource, cb CopyCallback) error
PointerSmudgeObject uses a Pointer and objectResource to download the object to the media directory. It does not write the file to the working directory.
func ResetTempDir ¶
func ResetTempDir() error
Types ¶
type CallbackReader ¶
type CallbackReader struct { C CopyCallback TotalSize int64 ReadSize int64 io.Reader }
type CleanedPointerError ¶ added in v0.5.1
type CleanedPointerError struct {
Bytes []byte
}
func (*CleanedPointerError) Error ¶ added in v0.5.1
func (e *CleanedPointerError) Error() string
type ClientError ¶
type ClientError struct { Message string `json:"message"` DocumentationUrl string `json:"documentation_url,omitempty"` RequestId string `json:"request_id,omitempty"` }
func (*ClientError) Error ¶
func (e *ClientError) Error() string
type Configuration ¶
type Configuration struct { CurrentRemote string // contains filtered or unexported fields }
func NewConfig ¶
func NewConfig() *Configuration
func (*Configuration) BatchTransfer ¶ added in v0.5.2
func (c *Configuration) BatchTransfer() bool
func (*Configuration) ConcurrentTransfers ¶ added in v0.5.2
func (c *Configuration) ConcurrentTransfers() int
func (*Configuration) Endpoint ¶
func (c *Configuration) Endpoint() Endpoint
func (*Configuration) Getenv ¶ added in v0.5.2
func (c *Configuration) Getenv(key string) string
func (*Configuration) GetenvBool ¶ added in v0.5.2
func (c *Configuration) GetenvBool(key string, def bool) bool
GetenvBool parses a boolean environment variable and returns the result as a bool. If the environment variable is unset, empty, or if the parsing fails, the value of def (default) is returned instead.
func (*Configuration) HttpClient ¶
func (c *Configuration) HttpClient() *HttpClient
func (*Configuration) RemoteEndpoint ¶
func (c *Configuration) RemoteEndpoint(remote string) Endpoint
func (*Configuration) Remotes ¶
func (c *Configuration) Remotes() []string
func (*Configuration) SetConfig ¶
func (c *Configuration) SetConfig(key, value string)
type CopyCallback ¶
func CopyCallbackFile ¶
type CredentialCmd ¶
func NewCommand ¶
func NewCommand(input Creds, subCommand string) *CredentialCmd
func (*CredentialCmd) Credentials ¶
func (c *CredentialCmd) Credentials() Creds
func (*CredentialCmd) StdoutString ¶
func (c *CredentialCmd) StdoutString() string
type Downloadable ¶ added in v0.5.2
type Downloadable struct { Pointer *WrappedPointer // contains filtered or unexported fields }
func NewDownloadable ¶ added in v0.5.2
func NewDownloadable(p *WrappedPointer) *Downloadable
func (*Downloadable) Check ¶ added in v0.5.2
func (d *Downloadable) Check() (*objectResource, *WrappedError)
func (*Downloadable) Name ¶ added in v0.5.2
func (d *Downloadable) Name() string
func (*Downloadable) Object ¶ added in v0.5.2
func (d *Downloadable) Object() *objectResource
func (*Downloadable) Oid ¶ added in v0.5.2
func (d *Downloadable) Oid() string
func (*Downloadable) SetObject ¶ added in v0.5.2
func (d *Downloadable) SetObject(o *objectResource)
func (*Downloadable) Size ¶ added in v0.5.2
func (d *Downloadable) Size() int64
func (*Downloadable) Transfer ¶ added in v0.5.2
func (d *Downloadable) Transfer(cb CopyCallback) *WrappedError
type Endpoint ¶
An Endpoint describes how to access a Git LFS server.
func NewEndpoint ¶ added in v0.5.2
NewEndpoint initializes a new Endpoint for a given URL.
func NewEndpointFromCloneURL ¶ added in v0.5.2
NewEndpointFromCloneURL creates an Endpoint from a git clone URL by appending "[.git]/info/lfs".
type HookExists ¶
func (*HookExists) Error ¶
func (e *HookExists) Error() string
type HttpClient ¶ added in v0.5.2
type Pointer ¶ added in v0.5.1
func NewPointer ¶ added in v0.5.1
type SmudgeError ¶ added in v0.5.1
type SmudgeError struct { Oid string Filename string *WrappedError }
type TransferQueue ¶ added in v0.5.2
type TransferQueue struct {
// contains filtered or unexported fields
}
TransferQueue provides a queue that will allow concurrent transfers.
func NewDownloadQueue ¶ added in v0.5.2
func NewDownloadQueue(workers, files int) *TransferQueue
NewDownloadQueue builds a DownloadQueue, allowing `workers` concurrent downloads.
func NewUploadQueue ¶ added in v0.5.1
func NewUploadQueue(workers, files int) *TransferQueue
NewUploadQueue builds an UploadQueue, allowing `workers` concurrent uploads.
func (*TransferQueue) Add ¶ added in v0.5.2
func (q *TransferQueue) Add(t Transferable)
Add adds a Transferable to the transfer queue.
func (*TransferQueue) Errors ¶ added in v0.5.2
func (q *TransferQueue) Errors() []*WrappedError
Errors returns any errors encountered during transfer.
func (*TransferQueue) Process ¶ added in v0.5.2
func (q *TransferQueue) Process()
Process starts the transfer queue and displays a progress bar. Process will do individual or batch transfers depending on the Config.BatchTransfer() value. Process will transfer files sequentially or concurrently depending on the Concig.ConcurrentTransfers() value.
func (*TransferQueue) Watch ¶ added in v0.5.2
func (q *TransferQueue) Watch() chan string
Watch returns a channel where the queue will write the OID of each transfer as it completes. The channel will be closed when the queue finishes processing.
type Transferable ¶ added in v0.5.2
type Transferable interface { Check() (*objectResource, *WrappedError) Transfer(CopyCallback) *WrappedError Object() *objectResource Oid() string Size() int64 Name() string SetObject(*objectResource) }
type Uploadable ¶ added in v0.5.1
Uploadable describes a file that can be uploaded.
func (*Uploadable) Check ¶ added in v0.5.2
func (u *Uploadable) Check() (*objectResource, *WrappedError)
func (*Uploadable) Name ¶ added in v0.5.2
func (u *Uploadable) Name() string
func (*Uploadable) Object ¶ added in v0.5.2
func (u *Uploadable) Object() *objectResource
func (*Uploadable) Oid ¶ added in v0.5.2
func (u *Uploadable) Oid() string
func (*Uploadable) SetObject ¶ added in v0.5.2
func (u *Uploadable) SetObject(o *objectResource)
func (*Uploadable) Size ¶ added in v0.5.1
func (u *Uploadable) Size() int64
func (*Uploadable) Transfer ¶ added in v0.5.2
func (u *Uploadable) Transfer(cb CopyCallback) *WrappedError
type WrappedError ¶
type WrappedError struct { Err error Message string Panic bool // contains filtered or unexported fields }
func Batch ¶ added in v0.5.2
func Batch(objects []*objectResource) ([]*objectResource, *WrappedError)
func Download ¶
func Download(oid string) (io.ReadCloser, int64, *WrappedError)
func DownloadCheck ¶ added in v0.5.2
func DownloadCheck(oid string) (*objectResource, *WrappedError)
func DownloadObject ¶ added in v0.5.2
func DownloadObject(obj *objectResource) (io.ReadCloser, int64, *WrappedError)
func Error ¶
func Error(err error) *WrappedError
func Errorf ¶
func Errorf(err error, format string, args ...interface{}) *WrappedError
func UploadCheck ¶ added in v0.5.2
func UploadCheck(oidPath string) (*objectResource, *WrappedError)
func UploadObject ¶ added in v0.5.2
func UploadObject(o *objectResource, cb CopyCallback) *WrappedError
func (*WrappedError) Context ¶
func (e *WrappedError) Context() map[string]string
func (*WrappedError) Del ¶
func (e *WrappedError) Del(key string)
func (*WrappedError) Error ¶
func (e *WrappedError) Error() string
func (*WrappedError) Errorf ¶
func (e *WrappedError) Errorf(format string, args ...interface{})
func (*WrappedError) Get ¶
func (e *WrappedError) Get(key string) string
func (*WrappedError) InnerError ¶
func (e *WrappedError) InnerError() string
func (*WrappedError) Set ¶
func (e *WrappedError) Set(key, value string)
func (*WrappedError) Stack ¶
func (e *WrappedError) Stack() []byte
type WrappedPointer ¶ added in v0.5.2
type WrappedPointer struct { Sha1 string Name string SrcName string Size int64 Status string *Pointer }
WrappedPointer wraps a pointer.Pointer and provides the git sha1 and the file name associated with the object, taken from the rev-list output.
func ScanIndex ¶ added in v0.5.1
func ScanIndex() ([]*WrappedPointer, error)
ScanIndex returns a slice of WrappedPointer objects for all Git LFS pointers it finds in the index.
func ScanRefs ¶ added in v0.5.1
func ScanRefs(refLeft, refRight string) ([]*WrappedPointer, error)
ScanRefs takes a ref and returns a slice of WrappedPointer objects for all Git LFS pointers it finds for that ref.