lfs

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2015 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const EndpointUrlUnknown = "<unknown>"
View Source
const (
	Version = "0.5.4"
)

Variables

View Source
var (
	LargeSizeThreshold = 5 * 1024 * 1024
	TempDir            = filepath.Join(os.TempDir(), "git-lfs")
	GitCommit          string
	UserAgent          string
	LocalWorkingDir    string
	LocalGitDir        string
	LocalMediaDir      string
	LocalLogDir        string
)
View Source
var (
	Config = NewConfig()
)
View Source
var (
	NotInARepositoryError = errors.New("Not in a repository")
)

Functions

func CopyWithCallback

func CopyWithCallback(writer io.Writer, reader io.Reader, totalSize int64, cb CopyCallback) (int64, error)

func EncodePointer added in v0.5.1

func EncodePointer(writer io.Writer, pointer *Pointer) (int, error)

func Environ

func Environ() []string

func InRepo

func InRepo() bool

func InstallFilters

func InstallFilters(force bool) error

func InstallHooks

func InstallHooks(force bool) error

func LocalMediaPath

func LocalMediaPath(sha string) (string, error)

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 LogTransfer(key string, res *http.Response)

func NewUploadable added in v0.5.1

func NewUploadable(oid, filename string) (*Uploadable, *WrappedError)

NewUploadable builds the Uploadable from the given information. "filename" can be empty if a raw object is pushed (see "object-id" flag in push command)/

func ObjectUrl

func ObjectUrl(endpoint Endpoint, oid string) (*url.URL, error)

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 PointerSmudge(writer io.Writer, ptr *Pointer, workingfile string, cb CopyCallback) error

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

func Stack

func Stack() []byte

func TempFile

func TempFile(prefix string) (*os.File, error)

func UninstallFilters added in v0.5.3

func UninstallFilters() error

func UninstallHooks added in v0.5.3

func UninstallHooks() error

Types

type CallbackReader

type CallbackReader struct {
	C         CopyCallback
	TotalSize int64
	ReadSize  int64
	io.Reader
}

func (*CallbackReader) Read

func (w *CallbackReader) Read(p []byte) (int, error)

type CleanedPointerError added in v0.5.1

type CleanedPointerError struct {
	Pointer *Pointer
	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) GitConfig

func (c *Configuration) GitConfig(key string) (string, bool)

func (*Configuration) HttpClient

func (c *Configuration) HttpClient() *HttpClient

func (*Configuration) ObjectUrl

func (c *Configuration) ObjectUrl(oid string) (*url.URL, error)

func (*Configuration) PrivateAccess added in v0.5.3

func (c *Configuration) PrivateAccess() bool

PrivateAccess will retrieve the access value and return true if the value is set to private. When a repo is marked as having private access, the http requests for the batch api will fetch the credentials before running, otherwise the request will run without credentials.

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)

func (*Configuration) SetPrivateAccess added in v0.5.3

func (c *Configuration) SetPrivateAccess()

SetPrivateAccess will set the private access flag in .git/config.

func (*Configuration) Setenv added in v0.5.3

func (c *Configuration) Setenv(key, value string) error

type CopyCallback

type CopyCallback func(totalSize int64, readSoFar int64, readSinceLast int) error

func CopyCallbackFile

func CopyCallbackFile(event, filename string, index, totalFiles int) (CopyCallback, *os.File, error)

type CredentialCmd

type CredentialCmd struct {
	SubCommand string
	*exec.Cmd
	// contains filtered or unexported fields
}

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 Creds

type Creds map[string]string

func (Creds) Buffer

func (c Creds) Buffer() *bytes.Buffer

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

type Endpoint struct {
	Url            string
	SshUserAndHost string
	SshPath        string
	SshPort        string
}

An Endpoint describes how to access a Git LFS server.

func NewEndpoint added in v0.5.2

func NewEndpoint(rawurl string) Endpoint

NewEndpoint initializes a new Endpoint for a given URL.

func NewEndpointFromCloneURL added in v0.5.2

func NewEndpointFromCloneURL(url string) Endpoint

NewEndpointFromCloneURL creates an Endpoint from a git clone URL by appending "[.git]/info/lfs".

type HookExists

type HookExists struct {
	Name     string
	Path     string
	Contents string
}

func (*HookExists) Error

func (e *HookExists) Error() string

type HttpClient added in v0.5.2

type HttpClient struct {
	*http.Client
}

func (*HttpClient) Do added in v0.5.2

func (c *HttpClient) Do(req *http.Request) (*http.Response, error)

type Pointer added in v0.5.1

type Pointer struct {
	Version string
	Oid     string
	Size    int64
	OidType string
}

func DecodeFrom added in v0.5.1

func DecodeFrom(reader io.Reader) ([]byte, *Pointer, error)

func DecodePointer added in v0.5.1

func DecodePointer(reader io.Reader) (*Pointer, error)

func NewPointer added in v0.5.1

func NewPointer(oid string, size int64) *Pointer

func (*Pointer) Encode added in v0.5.1

func (p *Pointer) Encode(writer io.Writer) (int, error)

func (*Pointer) Encoded added in v0.5.1

func (p *Pointer) Encoded() string

func (*Pointer) Smudge added in v0.5.1

func (p *Pointer) Smudge(writer io.Writer, workingfile string, cb CopyCallback) error

type ScanRefsOptions added in v0.5.3

type ScanRefsOptions struct {
	SkipDeletedBlobs bool
	// contains filtered or unexported fields
}

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

type Uploadable struct {
	OidPath  string
	Filename string
	// contains filtered or unexported fields
}

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, operation string) ([]*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, opt *ScanRefsOptions) ([]*WrappedPointer, error)

ScanRefs takes a ref and returns a slice of WrappedPointer objects for all Git LFS pointers it finds for that ref.

Jump to

Keyboard shortcuts

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