{"modulePath":"github.com/github/git-media","version":"v2.5.2+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package lfs\n\nPackage lfs brings together the core LFS functionality NOTE: Subject to change, do not rely on this package from outside git-lfs source\n\n## Constants\n\n```go\nconst (\n\tScanRefsMode         = ScanningMode(iota) // 0 - or default scan mode\n\tScanAllMode          = ScanningMode(iota)\n\tScanLeftToRemoteMode = ScanningMode(iota)\n)\n```\n\n```go\nconst (\n\tLogDiffAdditions = LogDiffDirection('+') // include '+' diffs\n\tLogDiffDeletions = LogDiffDirection('-') // include '-' diffs\n)\n```\n\n```go\nconst (\n\tPlatformWindows      = Platform(iota)\n\tPlatformLinux        = Platform(iota)\n\tPlatformOSX          = Platform(iota)\n\tPlatformOther        = Platform(iota) // most likely a *nix variant e.g. freebsd\n\tPlatformUndetermined = Platform(iota)\n)\n```\n\n## Functions\n\n```go\nfunc CopyFileContents(cfg *config.Configuration, src string, dst string) error\n```\n\n```go\nfunc EncodePointer(writer io.Writer, pointer *Pointer) (int, error)\n```\n\n```go\nfunc Environ(cfg *config.Configuration, manifest *tq.Manifest) []string\n```\n\n```go\nfunc IsCallbackMissing(err error) bool\n```\nIsCallbackMissing returns a boolean indicating whether the error is reporting that a GitScanner is missing a required GitScannerCallback.\n\n```go\nfunc IsWindows() bool\n```\nAre we running on Windows? Need to handle some extra path shenanigans\n\n```go\nfunc LinkOrCopy(cfg *config.Configuration, src string, dst string) error\n```\n\n```go\nfunc LinkOrCopyFromReference(cfg *config.Configuration, oid string, size int64) error\n```\n\n## Types\n\n```go\ntype Attribute struct {\n\t// The Section of an Attribute refers to the location at which all\n\t// properties are relative to. For example, for a Section with the value\n\t// \"core\", Git will produce something like:\n\t//\n\t// [core]\n\t//\tautocrlf = true\n\t//\t...\n\tSection string\n\n\t// The Properties of an Attribute refer to all of the keys and values\n\t// that define that Attribute.\n\tProperties map[string]string\n\t// Previous values of these attributes that can be automatically upgraded\n\tUpgradeables map[string][]string\n}\n```\nAttribute wraps the structure and some operations of Git's conception of an \"attribute\", as defined here: [http://git-scm.com/docs/gitattributes](http://git-scm.com/docs/gitattributes).\n\n```go\nfunc (a *Attribute) Install(opt *FilterOptions) error\n```\nInstall 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.\n\n```go\nfunc (a *Attribute) Uninstall(opt *FilterOptions)\n```\nUninstall removes all properties in the path of this property.\n\n```go\ntype ByPriority []*PointerExtension\n```\n\n```go\nfunc (p ByPriority) Len() int\n```\n\n```go\nfunc (p ByPriority) Less(i, j int) bool\n```\n\n```go\nfunc (p ByPriority) Swap(i, j int)\n```\n\n```go\ntype DiffIndexEntry struct {\n\t// SrcMode is the file mode of the \"src\" file, stored as a string-based\n\t// octal.\n\tSrcMode string\n\t// DstMode is the file mode of the \"dst\" file, stored as a string-based\n\t// octal.\n\tDstMode string\n\t// SrcSha is the Git blob ID of the \"src\" file.\n\tSrcSha string\n\t// DstSha is the Git blob ID of the \"dst\" file.\n\tDstSha string\n\t// Status is the status of the file in the index.\n\tStatus DiffIndexStatus\n\t// StatusScore is the optional \"score\" associated with a particular\n\t// status.\n\tStatusScore int\n\t// SrcName is the name of the file in its \"src\" state as it appears in\n\t// the index.\n\tSrcName string\n\t// DstName is the name of the file in its \"dst\" state as it appears in\n\t// the index.\n\tDstName string\n}\n```\nDiffIndexEntry holds information about a single item in the results of a \\`git diff-index\\` command.\n\n```go\ntype DiffIndexScanner struct {\n\t// contains filtered or unexported fields\n}\n```\nDiffIndexScanner scans the output of the \\`git diff-index\\` command.\n\n```go\nfunc NewDiffIndexScanner(ref string, cached bool) (*DiffIndexScanner, error)\n```\nNewDiffIndexScanner initializes a new \\`DiffIndexScanner\\` scanning at the given ref, \"ref\".\n\nIf \"cache\" is given, the DiffIndexScanner will scan for differences between the given ref and the index. If \"cache\" is \\_not\\_ given, DiffIndexScanner will scan for differences between the given ref and the currently checked out tree.\n\nIf any error was encountered in starting the command or closing its \\`stdin\\`, that error will be returned immediately. Otherwise, a \\`\\*DiffIndexScanner\\` will be returned with a \\`nil\\` error.\n\n```go\nfunc (s *DiffIndexScanner) Entry() *DiffIndexEntry\n```\nEntry returns the last entry that was Scan()'d by the DiffIndexScanner.\n\n```go\nfunc (s *DiffIndexScanner) Err() error\n```\nEntry returns the last error that was encountered by the DiffIndexScanner.\n\n```go\nfunc (s *DiffIndexScanner) Scan() bool\n```\nScan advances the scan line and yields either a new value for Entry(), or an Err(). It returns true or false, whether or not it can continue scanning for more entries.\n\n```go\ntype DiffIndexStatus rune\n```\nStatus represents the status of a file that appears in the output of \\`git diff-index\\`.\n\nMore information about each of its valid instances can be found: [https://git-scm.com/docs/git-diff-index](https://git-scm.com/docs/git-diff-index)\n\n```go\nconst (\n\tStatusAddition     DiffIndexStatus = 'A'\n\tStatusCopy         DiffIndexStatus = 'C'\n\tStatusDeletion     DiffIndexStatus = 'D'\n\tStatusModification DiffIndexStatus = 'M'\n\tStatusRename       DiffIndexStatus = 'R'\n\tStatusTypeChange   DiffIndexStatus = 'T'\n\tStatusUnmerged     DiffIndexStatus = 'U'\n\tStatusUnknown      DiffIndexStatus = 'X'\n)\n```\n\n```go\nfunc (s DiffIndexStatus) Format(state fmt.State, c rune)\n```\nFormat implements fmt.Formatter. If printed as \"%+d\", \"%+s\", or \"%+v\", the status will be written out as an English word: i.e., \"addition\", \"copy\", \"deletion\", etc.\n\nIf the '+' flag is not given, the shorthand will be used instead: 'A', 'C', and 'D', respectively.\n\nIf any other format verb is given, this function will panic().\n\n```go\nfunc (s DiffIndexStatus) String() string\n```\nString implements fmt.Stringer by returning a human-readable name for each status.\n\n```go\ntype FetchPruneConfig struct {\n\t// The number of days prior to current date for which (local) refs other than HEAD\n\t// will be fetched with --recent (default 7, 0 = only fetch HEAD)\n\tFetchRecentRefsDays int\n\t// Makes the FetchRecentRefsDays option apply to remote refs from fetch source as well (default true)\n\tFetchRecentRefsIncludeRemotes bool\n\t// number of days prior to latest commit on a ref that we'll fetch previous\n\t// LFS changes too (default 0 = only fetch at ref)\n\tFetchRecentCommitsDays int\n\t// Whether to always fetch recent even without --recent\n\tFetchRecentAlways bool\n\t// Number of days added to FetchRecent*; data outside combined window will be\n\t// deleted when prune is run. (default 3)\n\tPruneOffsetDays int\n\t// Always verify with remote before pruning\n\tPruneVerifyRemoteAlways bool\n\t// Name of remote to check for unpushed and verify checks\n\tPruneRemoteName string\n}\n```\nFetchPruneConfig collects together the config options that control fetching and pruning\n\n```go\nfunc NewFetchPruneConfig(git config.Environment) FetchPruneConfig\n```\n\n```go\ntype FilterOptions struct {\n\tGitConfig  *git.Configuration\n\tForce      bool\n\tLocal      bool\n\tSystem     bool\n\tSkipSmudge bool\n}\n```\nFilterOptions serves as an argument to Install().\n\n```go\nfunc (o *FilterOptions) Install() error\n```\n\n```go\nfunc (o *FilterOptions) Uninstall() error\n```\n\n```go\ntype GitFilter struct {\n\t// contains filtered or unexported fields\n}\n```\nGitFilter provides clean and smudge capabilities\n\n```go\nfunc NewGitFilter(cfg *config.Configuration) *GitFilter\n```\nNewGitFilter initializes a new \\*GitFilter\n\n```go\nfunc (f *GitFilter) Clean(reader io.Reader, fileName string, fileSize int64, cb tools.CopyCallback) (*cleanedAsset, error)\n```\n\n```go\nfunc (f *GitFilter) CopyCallbackFile(event, filename string, index, totalFiles int) (tools.CopyCallback, *os.File, error)\n```\n\n```go\nfunc (f *GitFilter) ObjectPath(oid string) (string, error)\n```\n\n```go\nfunc (f *GitFilter) RemoteRef() *git.Ref\n```\n\n```go\nfunc (f *GitFilter) Smudge(writer io.Writer, ptr *Pointer, workingfile string, download bool, manifest *tq.Manifest, cb tools.CopyCallback) (int64, error)\n```\n\n```go\nfunc (f *GitFilter) SmudgeToFile(filename string, ptr *Pointer, download bool, manifest *tq.Manifest, cb tools.CopyCallback) error\n```\n\n```go\ntype GitScanner struct {\n\tFilter             *filepathfilter.Filter\n\tFoundPointer       GitScannerFoundPointer\n\tFoundLockable      GitScannerFoundLockable\n\tPotentialLockables GitScannerSet\n\t// contains filtered or unexported fields\n}\n```\nGitScanner scans objects in a Git repository for LFS pointers.\n\n```go\nfunc NewGitScanner(cb GitScannerFoundPointer) *GitScanner\n```\nNewGitScanner initializes a \\*GitScanner for a Git repository in the current working directory.\n\n```go\nfunc (s *GitScanner) Close()\n```\nClose stops exits once all processing has stopped, and all resources are tracked and cleaned up.\n\n```go\nfunc (s *GitScanner) RemoteForPush(r string) error\n```\nRemoteForPush sets up this \\*GitScanner to scan for objects to push to the given remote. Needed for ScanLeftToRemote().\n\n```go\nfunc (s *GitScanner) ScanAll(cb GitScannerFoundPointer) error\n```\nScanAll scans through all objects in the git repository.\n\n```go\nfunc (s *GitScanner) ScanIndex(ref string, cb GitScannerFoundPointer) error\n```\nScanIndex scans the git index for modified LFS objects.\n\n```go\nfunc (s *GitScanner) ScanLeftToRemote(left string, cb GitScannerFoundPointer) error\n```\nScanLeftToRemote scans through all commits starting at the given ref that the given remote does not have. See RemoteForPush().\n\n```go\nfunc (s *GitScanner) ScanPreviousVersions(ref string, since time.Time, cb GitScannerFoundPointer) error\n```\nScanPreviousVersions scans changes reachable from ref (commit) back to since. Returns channel of pointers for \\*previous\\* versions that overlap that time. Does not include pointers which were still in use at ref (use ScanRefsToChan for that)\n\n```go\nfunc (s *GitScanner) ScanRef(ref string, cb GitScannerFoundPointer) error\n```\nScanRef scans through all objects in the current ref, excluding git objects that have been modified or deleted before the ref.\n\n```go\nfunc (s *GitScanner) ScanRefRange(left, right string, cb GitScannerFoundPointer) error\n```\nScanRefRange scans through all commits from the given left and right refs, including git objects that have been modified or deleted.\n\n```go\nfunc (s *GitScanner) ScanRefWithDeleted(ref string, cb GitScannerFoundPointer) error\n```\nScanRefWithDeleted scans through all objects in the given ref, including git objects that have been modified or deleted.\n\n```go\nfunc (s *GitScanner) ScanRefs(include, exclude []string, cb GitScannerFoundPointer) error\n```\nScanRefs through all commits reachable by refs contained in \"include\" and not reachable by any refs included in \"excluded\"\n\n```go\nfunc (s *GitScanner) ScanTree(ref string) error\n```\nScanTree takes a ref and returns 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.\n\n```go\nfunc (s *GitScanner) ScanUnpushed(remote string, cb GitScannerFoundPointer) error\n```\nScanUnpushed scans history for all LFS pointers which have been added but not pushed to the named remote. remote can be left blank to mean 'any remote'.\n\n```go\ntype GitScannerFoundLockable func(filename string)\n```\n\n```go\ntype GitScannerFoundPointer func(*WrappedPointer, error)\n```\n\n```go\ntype GitScannerSet interface {\n\tContains(string) bool\n}\n```\n\n```go\ntype Hook struct {\n\tType     string\n\tContents string\n\tDir      string\n\t// contains filtered or unexported fields\n}\n```\nA Hook represents a githook as described in [http://git-scm.com/docs/githooks](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.\n\n```go\nfunc LoadHooks(hookDir string) []*Hook\n```\n\n```go\nfunc NewStandardHook(theType, hookDir string, upgradeables []string) *Hook\n```\nNewStandardHook creates a new hook using the template script calling 'git lfs theType'\n\n```go\nfunc (h *Hook) Exists() bool\n```\n\n```go\nfunc (h *Hook) Install(force bool) error\n```\nInstall 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.\n\n```go\nfunc (h *Hook) Path() string\n```\nPath returns the desired (or actual, if installed) location where this hook should be installed. It returns an absolute path in all cases.\n\n```go\nfunc (h *Hook) Uninstall() error\n```\nUninstall removes the hook on disk so long as it matches the current version, or any of the past versions of this hook.\n\n```go\nfunc (h *Hook) Upgrade() error\n```\nUpgrade 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.\n\n```go\ntype LogDiffDirection byte\n```\nWhen 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\n\n```go\ntype PathConverter interface {\n\tConvert(string) string\n}\n```\n\n```go\nfunc NewCurrentToRepoPathConverter(cfg *config.Configuration) (PathConverter, error)\n```\nConvert 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 \u0026 expects to use relative args Pass in a channel which you will fill with relative files \u0026 receive a channel which will get results\n\n```go\nfunc NewRepoToCurrentPathConverter(cfg *config.Configuration) (PathConverter, error)\n```\nConvert 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 \u0026 receive a channel which will get results\n\n```go\ntype Platform int\n```\n\n```go\nfunc GetPlatform() Platform\n```\n\n```go\ntype Pointer struct {\n\tVersion    string\n\tOid        string\n\tSize       int64\n\tOidType    string\n\tExtensions []*PointerExtension\n}\n```\n\n```go\nfunc DecodeFrom(reader io.Reader) (*Pointer, io.Reader, error)\n```\nDecodeFrom decodes an \\*lfs.Pointer from the given io.Reader, \"reader\". If the pointer encoded in the reader could successfully be read and decoded, it will be returned with a nil error.\n\nIf the pointer could not be decoded, an io.Reader containing the entire blob's data will be returned, along with a parse error.\n\n```go\nfunc DecodePointer(reader io.Reader) (*Pointer, error)\n```\n\n```go\nfunc DecodePointerFromFile(file string) (*Pointer, error)\n```\n\n```go\nfunc NewPointer(oid string, size int64, exts []*PointerExtension) *Pointer\n```\n\n```go\nfunc (p *Pointer) Encode(writer io.Writer) (int, error)\n```\n\n```go\nfunc (p *Pointer) Encoded() string\n```\n\n```go\ntype PointerChannelWrapper struct {\n\t*tools.BaseChannelWrapper\n\tResults \u003c-chan *WrappedPointer\n}\n```\nChannelWrapper for pointer Scan\\* functions to more easily return async error data via Wait() See NewPointerChannelWrapper for construction / use\n\n```go\nfunc NewPointerChannelWrapper(pointerChan \u003c-chan *WrappedPointer, errorChan \u003c-chan error) *PointerChannelWrapper\n```\nConstruct a new channel wrapper for WrappedPointer Caller can use s.Results directly for normal processing then call Wait() to finish \u0026 check for errors Scan function is required to create error channel large enough not to block (usually 1 is ok)\n\n```go\ntype PointerExtension struct {\n\tName     string\n\tPriority int\n\tOid      string\n\tOidType  string\n}\n```\nA PointerExtension is parsed from the Git LFS Pointer file.\n\n```go\nfunc NewPointerExtension(name string, priority int, oid string) *PointerExtension\n```\n\n```go\ntype PointerScanner struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewPointerScanner() (*PointerScanner, error)\n```\n\n```go\nfunc (s *PointerScanner) BlobSHA() string\n```\n\n```go\nfunc (s *PointerScanner) Close() error\n```\n\n```go\nfunc (s *PointerScanner) ContentsSha() string\n```\n\n```go\nfunc (s *PointerScanner) Err() error\n```\n\n```go\nfunc (s *PointerScanner) Pointer() *WrappedPointer\n```\n\n```go\nfunc (s *PointerScanner) Scan(sha string) bool\n```\n\n```go\ntype ScanRefsOptions struct {\n\tScanMode         ScanningMode\n\tRemoteName       string\n\tSkipDeletedBlobs bool\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (o *ScanRefsOptions) GetName(sha string) (string, bool)\n```\n\n```go\nfunc (o *ScanRefsOptions) SetName(sha, name string)\n```\n\n```go\ntype ScanningMode int\n```\n\n```go\ntype StringChannelWrapper struct {\n\t*tools.BaseChannelWrapper\n\tResults \u003c-chan string\n}\n```\nChannelWrapper for string channel functions to more easily return async error data via Wait() Caller can use s.Results directly for normal processing then call Wait() to finish \u0026 check for errors See NewStringChannelWrapper for construction / use\n\n```go\nfunc NewStringChannelWrapper(stringChan \u003c-chan string, errorChan \u003c-chan error) *StringChannelWrapper\n```\nConstruct a new channel wrapper for string Caller can use s.Results directly for normal processing then call Wait() to finish \u0026 check for errors\n\n```go\ntype TreeBlob struct {\n\tSha1     string\n\tFilename string\n}\n```\nAn entry from ls-tree or rev-list including a blob sha and tree path\n\n```go\ntype TreeBlobChannelWrapper struct {\n\t*tools.BaseChannelWrapper\n\tResults \u003c-chan TreeBlob\n}\n```\nChannelWrapper for TreeBlob channel functions to more easily return async error data via Wait() See NewTreeBlobChannelWrapper for construction / use\n\n```go\nfunc NewTreeBlobChannelWrapper(treeBlobChan \u003c-chan TreeBlob, errorChan \u003c-chan error) *TreeBlobChannelWrapper\n```\nConstruct a new channel wrapper for TreeBlob Caller can use s.Results directly for normal processing then call Wait() to finish \u0026 check for errors\n\n```go\ntype WrappedPointer struct {\n\tSha1    string\n\tName    string\n\tSrcName string\n\tStatus  string\n\t*Pointer\n}\n```\nWrappedPointer wraps a pointer.Pointer and provides the git sha1 and the file name associated with the object, taken from the rev-list output.\n\n","path":"github.com/github/git-media/lfs","name":"lfs","synopsis":"Package lfs brings together the core LFS functionality NOTE: Subject to change, do not rely on this package from outside git-lfs source","isRedistributable":true}
