lfs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2015 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScanRefsMode         = ScanningMode(iota) // 0 - or default scan mode
	ScanAllMode          = ScanningMode(iota)
	ScanLeftToRemoteMode = ScanningMode(iota)
)
View Source
const (
	LogDiffAdditions = LogDiffDirection('+') // include '+' diffs
	LogDiffDeletions = LogDiffDirection('-') // include '-' diffs
)
View Source
const (
	PlatformWindows      = Platform(iota)
	PlatformLinux        = Platform(iota)
	PlatformOSX          = Platform(iota)
	PlatformOther        = Platform(iota) // most likely a *nix variant e.g. freebsd
	PlatformUndetermined = Platform(iota)
)
View Source
const EndpointUrlUnknown = "<unknown>"
View Source
const (
	Version = "1.0.0"
)

Variables

View Source
var (
	LargeSizeThreshold = 5 * 1024 * 1024
	TempDir            = filepath.Join(os.TempDir(), "git-lfs")
	GitCommit          string
	UserAgent          string
	LocalWorkingDir    string
	LocalGitDir        string // parent of index / config / hooks etc
	LocalGitStorageDir string // parent of objects/lfs (may be same as LocalGitDir but may not)
	LocalMediaDir      string // root of lfs objects
	LocalLogDir        string
)
View Source
var (
	Config = NewConfig()
)

Functions

func Batch added in v0.5.2

func Batch(objects []*objectResource, operation string) ([]*objectResource, error)

func ConvertCwdFilesRelativeToRepo added in v0.6.0

func ConvertCwdFilesRelativeToRepo(cwdchan <-chan string) (<-chan string, error)

Convert filenames expressed relative to the current directory to be relative to the repo root. Useful when calling git with arguments that requires them to be rooted but the user is in a subdir of their repo & expects to use relative args Pass in a channel which you will fill with relative files & receive a channel which will get results

func ConvertRepoFilesRelativeToCwd added in v0.6.0

func ConvertRepoFilesRelativeToCwd(repochan <-chan string) (<-chan string, error)

Convert filenames expressed relative to the root of the repo relative to the current working dir. Useful when needing to calling git with results from a rooted command, but the user is in a subdir of their repo Pass in a channel which you will fill with relative files & receive a channel which will get results

func CopyWithCallback

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

func DirExists added in v0.6.0

func DirExists(path string) bool

DirExists determines if a dir (NOT file) exists.

func Download

func Download(oid string) (io.ReadCloser, int64, error)

func DownloadCheck added in v0.5.2

func DownloadCheck(oid string) (*objectResource, error)

func DownloadObject added in v0.5.2

func DownloadObject(obj *objectResource) (io.ReadCloser, int64, error)

func EncodePointer added in v0.5.1

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

func Environ

func Environ() []string

func Error

func Error(err error) error

Error wraps an error with an empty message.

func ErrorContext added in v0.6.0

func ErrorContext(err error) map[string]interface{}

ErrorContext returns the context map for an error if it is a wrappedError. If it is not a wrappedError it will return an empty map.

func ErrorDelContext added in v0.6.0

func ErrorDelContext(err error, key string)

ErrorDelContext removes a value from the error's context. If the error has not been wrapped, it does nothing.

func ErrorGetContext added in v0.6.0

func ErrorGetContext(err error, key string) interface{}

ErrorGetContext gets a value from the error's context. If the error has not been wrapped, it returns an empty string.

func ErrorSetContext added in v0.6.0

func ErrorSetContext(err error, key string, value interface{})

ErrorSetContext sets a value in the error's context. If the error has not been wrapped, it does nothing.

func ErrorStack added in v0.6.0

func ErrorStack(err error) []byte

ErrorStack returns the stack for an error if it is a wrappedError. If it is not a wrappedError it will return an empty byte slice.

func Errorf

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

Errorf wraps an error with an additional formatted message.

func FileExists added in v0.6.0

func FileExists(path string) bool

FileExists determines if a file (NOT dir) exists.

func FileExistsOfSize added in v0.6.0

func FileExistsOfSize(path string, sz int64) bool

FileExistsOfSize determines if a file exists and is of a specific size.

func FileOrDirExists added in v0.6.0

func FileOrDirExists(path string) (exists bool, isDir bool)

FileOrDirExists determines if a file/dir exists, returns IsDir() results too.

func FilenamePassesIncludeExcludeFilter added in v0.6.0

func FilenamePassesIncludeExcludeFilter(filename string, includePaths, excludePaths []string) bool

Return whether a given filename passes the include / exclude path filters Only paths that are in includePaths and outside excludePaths are passed If includePaths is empty that filter always passes and the same with excludePaths Both path lists support wildcard matches

func InRepo

func InRepo() bool

func InstallFilters

func InstallFilters(opt InstallOptions, passThrough bool) error

InstallFilters installs filters necessary for git-lfs to process normal git operations. Currently, that list includes:

  • smudge filter
  • clean filter

An error will be returned if a filter is unable to be set, or if the required filters were not present.

func InstallHooks

func InstallHooks(force bool) error

InstallHooks installs all hooks in the `hooks` var.

func IsAuthError added in v0.6.0

func IsAuthError(err error) bool

IsAuthError indicates the client provided a request with invalid or no authentication credentials when credentials are required (e.g. HTTP 401).

func IsBadPointerKeyError added in v1.0.0

func IsBadPointerKeyError(err error) bool

IsBadPointerKeyError indicates that the parsed data has an invalid key.

func IsCleanPointerError added in v0.6.0

func IsCleanPointerError(err error) bool

IsCleanPointerError indicates an error while cleaning a file.

func IsDownloadDeclinedError added in v0.6.0

func IsDownloadDeclinedError(err error) bool

IsDownloadDeclinedError indicates that the smudge operation should not download. TODO: I don't really like using errors to control that flow, it should be refactored.

func IsFatalError added in v0.6.0

func IsFatalError(err error) bool

IsFatalError indicates that the error is fatal and the process should exit immediately after handling the error.

func IsInvalidPointerError added in v0.6.0

func IsInvalidPointerError(err error) bool

IsInvalidPointerError indicates an attempt to parse data that was not a valid pointer.

func IsInvalidRepoError added in v0.6.0

func IsInvalidRepoError(err error) bool

IsInvalidRepoError indicates an operation was attempted from outside a git repository.

func IsNotAPointerError added in v0.6.0

func IsNotAPointerError(err error) bool

IsNotAPointerError indicates the parsed data is not an LFS pointer.

func IsNotImplementedError added in v0.6.0

func IsNotImplementedError(err error) bool

IsNotImplementedError indicates the client attempted to use a feature the server has not implemented (e.g. the batch endpoint).

func IsRetriableError added in v0.6.0

func IsRetriableError(err error) bool

IsRetriableError indicates the low level transfer had an error but the caller may retry the operation.

func IsSmudgeError added in v0.6.0

func IsSmudgeError(err error) bool

IsSmudgeError indicates an error while smudging a files.

func IsWindows added in v0.6.0

func IsWindows() bool

Are we running on Windows? Need to handle some extra path shenanigans

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 ObjectExistsOfSize added in v0.6.0

func ObjectExistsOfSize(sha string, size int64) bool

func ObjectUrl

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

func PointerClean added in v0.5.1

func PointerClean(reader io.Reader, fileName string, fileSize int64, cb CopyCallback) (*cleanedAsset, error)

func PointerSmudge added in v0.5.1

func PointerSmudge(writer io.Writer, ptr *Pointer, workingfile string, download bool, 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 PointerSmudgeToFile added in v0.6.0

func PointerSmudgeToFile(filename string, ptr *Pointer, download bool, cb CopyCallback) error

func ResetTempDir

func ResetTempDir() error

func ResolveDirs added in v0.6.0

func ResolveDirs()

func ScanRefsToChan added in v0.6.0

func ScanRefsToChan(refLeft, refRight string, opt *ScanRefsOptions) (<-chan *WrappedPointer, error)

ScanRefsToChan takes a ref and returns a channel of WrappedPointer objects for all Git LFS pointers it finds for that ref. Reports unique oids once only, not multiple times if >1 file uses the same content

func Stack

func Stack() []byte

Stack returns a byte slice containing the runtime.Stack()

func TempFile

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

func UninstallFilters added in v0.5.3

func UninstallFilters() error

UninstallFilters proxies into the Uninstall method on the Filters type to remove all installed filters.

func UninstallHooks added in v0.5.3

func UninstallHooks() error

UninstallHooks resmoves all hooks in range of the `hooks` var.

func UploadCheck added in v0.5.2

func UploadCheck(oidPath string) (*objectResource, error)

func UploadObject added in v0.5.2

func UploadObject(o *objectResource, cb CopyCallback) error

Types

type Attribute added in v0.6.0

type Attribute struct {
	// The Section of an Attribute refers to the location at which all
	// properties are relative to. For example, for a Section with the value
	// "core", Git will produce something like:
	//
	// [core]
	//	autocrlf = true
	//	...
	Section string

	// The Properties of an Attribute refer to all of the keys and values
	// that define that Attribute.
	Properties map[string]string
}

Attribute wraps the structure and some operations of Git's conception of an "attribute", as defined here: http://git-scm.com/docs/gitattributes.

func (*Attribute) Install added in v0.6.0

func (a *Attribute) Install(opt InstallOptions) error

Install instructs Git to set all keys and values relative to the root location of this Attribute. For any particular key/value pair, if a matching key is already set, it will be overridden if it is either a) empty, or b) the `force` argument is passed as true. If an attribute is already set to a different value than what is given, and force is false, an error will be returned immediately, and the rest of the attributes will not be set.

func (*Attribute) Uninstall added in v0.6.0

func (a *Attribute) Uninstall()

Uninstall removes all properties in the path of this property.

type Batcher added in v0.6.0

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

Batcher provides a way to process a set of items in groups of n. Items can be added to the batcher from multiple goroutines and pulled off in groups when one of the following conditions occurs:

  • The batch size is reached
  • Exit() is called

When an Exit() occurs, the group may be smaller than the batch size.

func NewBatcher added in v0.6.0

func NewBatcher(batchSize int) *Batcher

NewBatcher creates a Batcher with the batchSize.

func (*Batcher) Add added in v0.6.0

func (b *Batcher) Add(t Transferable)

Add adds an item to the batcher. Add is safe to call from multiple goroutines.

func (*Batcher) Exit added in v0.6.0

func (b *Batcher) Exit()

Exit stops all batching and allows Next() to return. Calling Add() after calling Exit() will reset the batcher.

func (*Batcher) Next added in v0.6.0

func (b *Batcher) Next() []Transferable

Next will wait for the one of the above batch triggers to occur and return the accumulated batch.

type ByPriority added in v0.6.0

type ByPriority []*PointerExtension

func (ByPriority) Len added in v0.6.0

func (p ByPriority) Len() int

func (ByPriority) Less added in v0.6.0

func (p ByPriority) Less(i, j int) bool

func (ByPriority) Swap added in v0.6.0

func (p ByPriority) Swap(i, j int)

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 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) Access added in v0.6.0

func (c *Configuration) Access() string

Access returns the access auth type.

func (*Configuration) AllGitConfig added in v0.6.0

func (c *Configuration) AllGitConfig() map[string]string

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) EndpointAccess added in v0.6.0

func (c *Configuration) EndpointAccess(e Endpoint) string

func (*Configuration) Extensions added in v0.6.0

func (c *Configuration) Extensions() map[string]Extension

func (*Configuration) FetchExcludePaths added in v0.6.0

func (c *Configuration) FetchExcludePaths() []string

func (*Configuration) FetchIncludePaths added in v0.6.0

func (c *Configuration) FetchIncludePaths() []string

func (*Configuration) FetchPruneConfig added in v0.6.0

func (c *Configuration) FetchPruneConfig() *FetchPruneConfig

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) SetAccess added in v0.6.0

func (c *Configuration) SetAccess(authType string)

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

func (*Configuration) SetEndpointAccess added in v0.6.0

func (c *Configuration) SetEndpointAccess(e Endpoint, authType string)

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 Creds

type Creds map[string]string

func (Creds) Buffer

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

type DownloadCheckable added in v0.6.0

type DownloadCheckable struct {
	Pointer *WrappedPointer
	// contains filtered or unexported fields
}

The ability to check that a file can be downloaded

func NewDownloadCheckable added in v0.6.0

func NewDownloadCheckable(p *WrappedPointer) *DownloadCheckable

func (*DownloadCheckable) Check added in v0.6.0

func (d *DownloadCheckable) Check() (*objectResource, error)

func (*DownloadCheckable) Name added in v0.6.0

func (d *DownloadCheckable) Name() string

func (*DownloadCheckable) Object added in v0.6.0

func (d *DownloadCheckable) Object() *objectResource

func (*DownloadCheckable) Oid added in v0.6.0

func (d *DownloadCheckable) Oid() string

func (*DownloadCheckable) SetObject added in v0.6.0

func (d *DownloadCheckable) SetObject(o *objectResource)

func (*DownloadCheckable) Size added in v0.6.0

func (d *DownloadCheckable) Size() int64

func (*DownloadCheckable) Transfer added in v0.6.0

func (d *DownloadCheckable) Transfer(cb CopyCallback) error

type Downloadable added in v0.5.2

type Downloadable struct {
	*DownloadCheckable
}

The ability to actually download

func NewDownloadable added in v0.5.2

func NewDownloadable(p *WrappedPointer) *Downloadable

func (*Downloadable) Transfer added in v0.5.2

func (d *Downloadable) Transfer(cb CopyCallback) error

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 Extension added in v0.6.0

type Extension struct {
	Name     string
	Clean    string
	Smudge   string
	Priority int
}

An Extension describes how to manipulate files during smudge and clean. Extensions are parsed from the Git config.

func SortExtensions added in v0.6.0

func SortExtensions(m map[string]Extension) ([]Extension, error)

SortExtensions sorts a map of extensions in ascending order by Priority

type FetchPruneConfig added in v0.6.0

type FetchPruneConfig struct {
	// The number of days prior to current date for which (local) refs other than HEAD
	// will be fetched with --recent (default 7, 0 = only fetch HEAD)
	FetchRecentRefsDays int
	// Makes the FetchRecentRefsDays option apply to remote refs from fetch source as well (default true)
	FetchRecentRefsIncludeRemotes bool
	// number of days prior to latest commit on a ref that we'll fetch previous
	// LFS changes too (default 0 = only fetch at ref)
	FetchRecentCommitsDays int
	// Whether to always fetch recent even without --recent
	FetchRecentAlways bool
	// Number of days added to FetchRecent*; data outside combined window will be
	// deleted when prune is run. (default 3)
	PruneOffsetDays int
}

FetchPruneConfig collects together the config options that control fetching and pruning

type Hook added in v0.6.0

type Hook struct {
	Type         string
	Contents     string
	Upgradeables []string
}

A Hook represents a githook as described in http://git-scm.com/docs/githooks. Hooks have a type, which is the type of hook that they are, and a body, which represents the thing they will execute when invoked by Git.

func (*Hook) Exists added in v0.6.0

func (h *Hook) Exists() bool

func (*Hook) Install added in v0.6.0

func (h *Hook) Install(force bool) error

Install installs this Git hook on disk, or upgrades it if it does exist, and is upgradeable. It will create a hooks directory relative to the local Git directory. It returns and halts at any errors, and returns nil if the operation was a success.

func (*Hook) Path added in v0.6.0

func (h *Hook) Path() string

Path returns the desired (or actual, if installed) location where this hook should be installed, relative to the local Git directory.

func (*Hook) Uninstall added in v0.6.0

func (h *Hook) Uninstall() error

Uninstall removes the hook on disk so long as it matches the current version, or any of the past versions of this hook.

func (*Hook) Upgrade added in v0.6.0

func (h *Hook) Upgrade() error

Upgrade upgrades the (assumed to be) existing git hook to the current contents. A hook is considered "upgrade-able" if its contents are matched in the member variable `Upgradeables`. It halts and returns any errors as they arise.

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 InstallOptions added in v1.0.0

type InstallOptions struct {
	Force bool
	Local bool
}

InstallOptions serves as an argument to Install().

type LogDiffDirection added in v0.6.0

type LogDiffDirection byte

When scanning diffs e.g. parseLogOutputToPointers, which direction of diff to include data from, i.e. '+' or '-'. Depending on what you're scanning for either might be useful

type Platform added in v0.6.0

type Platform int

func GetPlatform added in v0.6.0

func GetPlatform() Platform

type Pointer added in v0.5.1

type Pointer struct {
	Version    string
	Oid        string
	Size       int64
	OidType    string
	Extensions []*PointerExtension
}

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 DecodePointerFromFile added in v0.6.0

func DecodePointerFromFile(file string) (*Pointer, error)

func NewPointer added in v0.5.1

func NewPointer(oid string, size int64, exts []*PointerExtension) *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, download bool, cb CopyCallback) error

type PointerExtension added in v0.6.0

type PointerExtension struct {
	Name     string
	Priority int
	Oid      string
	OidType  string
}

A PointerExtension is parsed from the Git LFS Pointer file.

func NewPointerExtension added in v0.6.0

func NewPointerExtension(name string, priority int, oid string) *PointerExtension

type ProgressMeter added in v0.6.0

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

ProgressMeter provides a progress bar type output for the TransferQueue. It is given an estimated file count and size up front and tracks the number of files and bytes transferred as well as the number of files and bytes that get skipped because the transfer is unnecessary.

func NewProgressMeter added in v0.6.0

func NewProgressMeter(estFiles int, estBytes int64, dryRun bool) *ProgressMeter

NewProgressMeter creates a new ProgressMeter for the number and size of files given.

func (*ProgressMeter) Add added in v0.6.0

func (p *ProgressMeter) Add(name string)

Add tells the progress meter that a transferring file is being added to the TransferQueue.

func (*ProgressMeter) Finish added in v0.6.0

func (p *ProgressMeter) Finish()

Finish shuts down the ProgressMeter

func (*ProgressMeter) FinishTransfer added in v0.6.0

func (p *ProgressMeter) FinishTransfer(name string)

FinishTransfer increments the finished transfer count

func (*ProgressMeter) Skip added in v0.6.0

func (p *ProgressMeter) Skip(size int64)

Skip tells the progress meter that a file of size `size` is being skipped because the transfer is unnecessary.

func (*ProgressMeter) Start added in v0.6.0

func (p *ProgressMeter) Start()

func (*ProgressMeter) TransferBytes added in v0.6.0

func (p *ProgressMeter) TransferBytes(direction, name string, read, total int64, current int)

TransferBytes increments the number of bytes transferred

type ScanRefsOptions added in v0.5.3

type ScanRefsOptions struct {
	ScanMode         ScanningMode
	RemoteName       string
	SkipDeletedBlobs bool
	// contains filtered or unexported fields
}

type ScanningMode added in v0.6.0

type ScanningMode int

type Spinner added in v0.6.0

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

Indeterminate progress indicator 'spinner'

func NewSpinner added in v0.6.0

func NewSpinner() *Spinner

func (*Spinner) Finish added in v0.6.0

func (s *Spinner) Finish(out io.Writer, finishMsg string)

Finish the spinner with a completion message & newline

func (*Spinner) Print added in v0.6.0

func (s *Spinner) Print(out io.Writer, msg string)

Print a spinner (stage) to out followed by msg (no linefeed)

func (*Spinner) Spin added in v0.6.0

func (s *Spinner) Spin(out io.Writer)

Just spin the spinner one more notch & use the last message

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 NewDownloadCheckQueue added in v0.6.0

func NewDownloadCheckQueue(files int, size int64, dryRun bool) *TransferQueue

NewDownloadCheckQueue builds a checking queue, allowing `workers` concurrent check operations.

func NewDownloadQueue added in v0.5.2

func NewDownloadQueue(files int, size int64, dryRun bool) *TransferQueue

NewDownloadQueue builds a DownloadQueue, allowing `workers` concurrent downloads.

func NewUploadQueue added in v0.5.1

func NewUploadQueue(files int, size int64, dryRun bool) *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() []error

Errors returns any errors encountered during transfer.

func (*TransferQueue) Wait added in v0.6.0

func (q *TransferQueue) Wait()

Wait waits for the queue to finish processing all transfers. Once Wait is called, Add will no longer add transferables to the queue. Any failed transfers will be automatically retried once.

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, error)
	Transfer(CopyCallback) error
	Object() *objectResource
	Oid() string
	Size() int64
	Name() string
	SetObject(*objectResource)
}

type TreeBlob added in v0.6.0

type TreeBlob struct {
	Sha1     string
	Filename string
}

An entry from ls-tree or rev-list including a blob sha and tree path

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

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

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 (*Uploadable) Check added in v0.5.2

func (u *Uploadable) Check() (*objectResource, error)

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) error

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. Reports unique oids once only, not multiple times if >1 file uses the same content

func ScanPreviousVersions added in v0.6.0

func ScanPreviousVersions(ref string, since time.Time) ([]*WrappedPointer, error)

ScanPreviousVersions scans changes reachable from ref (commit) back to since. Returns pointers for *previous* versions that overlap that time. Does not return pointers which were still in use at ref (use ScanRef for that)

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. Reports unique oids once only, not multiple times if >1 file uses the same content

func ScanTree added in v0.6.0

func ScanTree(ref string) ([]*WrappedPointer, error)

ScanTree takes a ref and returns a slice of WrappedPointer objects in the tree at that ref Differs from ScanRefs in that multiple files in the tree with the same content are all reported

func ScanUnpushed added in v0.6.0

func ScanUnpushed() ([]*WrappedPointer, error)

ScanUnpushed scans history for all LFS pointers which have been added but not pushed to any remote

Jump to

Keyboard shortcuts

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