lfs

package
v0.5.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const Version = "0.5.1"

Variables

View Source
var (
	LargeSizeThreshold = 5 * 1024 * 1024
	TempDir            = filepath.Join(os.TempDir(), "git-lfs")
	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 DoHTTP

func DoHTTP(c *Configuration, req *http.Request) (*http.Response, 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() error

func InstallHooks

func InstallHooks(force bool) error

func LocalMediaPath

func LocalMediaPath(sha string) (string, error)

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 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 ResetTempDir

func ResetTempDir() error

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.

func Stack

func Stack() []byte

func TempFile

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

Types

type AltConfig

type AltConfig struct {
	Remote map[string]*struct {
		Media string
	}

	Media struct {
		Url string
	}
}

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 {
	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) ConcurrentUploads added in v0.5.1

func (c *Configuration) ConcurrentUploads() int

func (*Configuration) Endpoint

func (c *Configuration) Endpoint() Endpoint

func (*Configuration) GitConfig

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

func (*Configuration) HttpClient

func (c *Configuration) HttpClient() *http.Client

func (*Configuration) ObjectUrl

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

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

type CopyCallback func(int64, int64, 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 Endpoint

type Endpoint struct {
	Url            string
	SshUserAndHost string
	SshPath        string
}

type HookExists

type HookExists struct {
	Name     string
	Path     string
	Contents string
}

func (*HookExists) Error

func (e *HookExists) Error() string

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 SmudgeError added in v0.5.1

type SmudgeError struct {
	Oid      string
	Filename string
	*WrappedError
}

type UploadQueue added in v0.5.1

type UploadQueue struct {
	// contains filtered or unexported fields
}

UploadQueue provides a queue that will allow concurrent uploads.

func NewUploadQueue added in v0.5.1

func NewUploadQueue(workers, files int) *UploadQueue

NewUploadQueue builds an UploadQueue, allowing `workers` concurrent uploads.

func (*UploadQueue) Add added in v0.5.1

func (q *UploadQueue) Add(u *Uploadable)

Add adds an Uploadable to the upload queue.

func (*UploadQueue) Errors added in v0.5.1

func (q *UploadQueue) Errors() []*WrappedError

Errors returns any errors encountered during uploading.

func (*UploadQueue) Process added in v0.5.1

func (q *UploadQueue) Process()

Process starts the upload queue and displays a progress bar.

type Uploadable added in v0.5.1

type Uploadable struct {
	OIDPath  string
	Filename string
	CB       CopyCallback
	Size     int64
}

Uploadable describes a file that can be uploaded.

type WrappedError

type WrappedError struct {
	Err     error
	Message string
	Panic   bool
	// contains filtered or unexported fields
}

func Download

func Download(oid string) (io.ReadCloser, int64, *WrappedError)

func Error

func Error(err error) *WrappedError

func Errorf

func Errorf(err error, format string, args ...interface{}) *WrappedError

func Upload

func Upload(oidPath, filename string, 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

Jump to

Keyboard shortcuts

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