{"modulePath":"github.com/github/git-media","version":"v2.5.2+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package config\n\nPackage config collects together all configuration settings NOTE: Subject to change, do not rely on this package from outside git-lfs source\n\n## Constants\n\n```go\nconst (\n\tVersion = \"2.5.2\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\tGitCommit   string\n\tVersionDesc string\n)\n```\n\n```go\nvar (\n\tShowConfigWarnings = false\n)\n```\n\n## Functions\n\n```go\nfunc Bool(value string, def bool) bool\n```\nBool returns the boolean state associated with the given value, or the value \"def\", if the value is blank.\n\nThe \"boolean state associated with a given key\" is defined as the case-insensitive string comparison with the following:\n\n 1. true if... \"true\", \"1\", \"on\", \"yes\", or \"t\"\n 2. false if... \"false\", \"0\", \"off\", \"no\", \"f\", or otherwise.\n\n```go\nfunc Int(value string, def int) int\n```\nInt returns the int value associated with the given value, or the value \"def\", if the value is blank.\n\nTo convert from a the string value attached to a given key, \\`strconv.Atoi(val)\\` is called. If \\`Atoi\\` returned a non-nil error, then the value \"def\" will be returned instead.\n\nOtherwise, if the value was converted \\`string -\u003e int\\` successfully, then it will be returned wholesale.\n\n## Types\n\n```go\ntype Configuration struct {\n\t// Os provides a `*Environment` used to access to the system's\n\t// environment through os.Getenv. It is the point of entry for all\n\t// system environment configuration.\n\tOs Environment\n\n\t// Git provides a `*Environment` used to access to the various levels of\n\t// `.gitconfig`'s. It is the point of entry for all Git environment\n\t// configuration.\n\tGit Environment\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New() *Configuration\n```\n\n```go\nfunc NewFrom(v Values) *Configuration\n```\nNewFrom returns a new \\`\\*config.Configuration\\` that reads both its Git and Enviornment-level values from the ones provided instead of the actual \\`.gitconfig\\` file or \\`os.Getenv\\`, respectively.\n\nThis method should only be used during testing.\n\n```go\nfunc NewIn(workdir, gitdir string) *Configuration\n```\n\n```go\nfunc (c *Configuration) BasicTransfersOnly() bool\n```\nBasicTransfersOnly returns whether to only allow \"basic\" HTTP transfers. Default is false, including if the lfs.basictransfersonly is invalid\n\n```go\nfunc (c *Configuration) Cleanup() error\n```\n\n```go\nfunc (c *Configuration) CurrentCommitter() (name, email string)\n```\nCurrentCommitter returns the name/email that would be used to author a commit with this configuration. In particular, the \"user.name\" and \"user.email\" configuration values are used\n\n```go\nfunc (c *Configuration) CurrentRef() *git.Ref\n```\n\n```go\nfunc (c *Configuration) EachLFSObject(fn func(fs.Object) error) error\n```\n\n```go\nfunc (c *Configuration) Extensions() map[string]Extension\n```\n\n```go\nfunc (c *Configuration) FetchExcludePaths() []string\n```\n\n```go\nfunc (c *Configuration) FetchIncludePaths() []string\n```\n\n```go\nfunc (c *Configuration) Filesystem() *fs.Filesystem\n```\n\n```go\nfunc (c *Configuration) FindGitGlobalKey(key string) string\n```\n\n```go\nfunc (c *Configuration) FindGitLocalKey(key string) string\n```\n\n```go\nfunc (c *Configuration) FindGitSystemKey(key string) string\n```\n\n```go\nfunc (c *Configuration) GitConfig() *git.Configuration\n```\n\n```go\nfunc (c *Configuration) GitEnv() Environment\n```\n\n```go\nfunc (c *Configuration) HookDir() string\n```\n\n```go\nfunc (c *Configuration) InRepo() bool\n```\n\n```go\nfunc (c *Configuration) IsDefaultRemote() bool\n```\n\n```go\nfunc (c *Configuration) LFSObjectDir() string\n```\n\n```go\nfunc (c *Configuration) LFSObjectExists(oid string, size int64) bool\n```\n\n```go\nfunc (c *Configuration) LFSStorageDir() string\n```\n\n```go\nfunc (c *Configuration) LocalGitDir() string\n```\n\n```go\nfunc (c *Configuration) LocalGitStorageDir() string\n```\n\n```go\nfunc (c *Configuration) LocalLogDir() string\n```\n\n```go\nfunc (c *Configuration) LocalReferenceDirs() []string\n```\n\n```go\nfunc (c *Configuration) LocalWorkingDir() string\n```\n\n```go\nfunc (c *Configuration) OSEnv() Environment\n```\n\n```go\nfunc (c *Configuration) PushRemote() string\n```\n\n```go\nfunc (c *Configuration) Remote() string\n```\nRemote returns the default remote based on: 1. The currently tracked remote branch, if present 2. Any other SINGLE remote defined in .git/config 3. Use \"origin\" as a fallback. Results are cached after the first hit.\n\n```go\nfunc (c *Configuration) Remotes() []string\n```\n\n```go\nfunc (c *Configuration) SetGitGlobalKey(key, val string) (string, error)\n```\n\n```go\nfunc (c *Configuration) SetGitLocalKey(key, val string) (string, error)\n```\n\n```go\nfunc (c *Configuration) SetGitSystemKey(key, val string) (string, error)\n```\n\n```go\nfunc (c *Configuration) SetLockableFilesReadOnly() bool\n```\n\n```go\nfunc (c *Configuration) SetPushRemote(name string)\n```\n\n```go\nfunc (c *Configuration) SetRemote(name string)\n```\n\n```go\nfunc (c *Configuration) SetValidPushRemote(name string) error\n```\n\n```go\nfunc (c *Configuration) SetValidRemote(name string) error\n```\n\n```go\nfunc (c *Configuration) SkipDownloadErrors() bool\n```\n\n```go\nfunc (c *Configuration) SortedExtensions() ([]Extension, error)\n```\nSortedExtensions gets the list of extensions ordered by Priority\n\n```go\nfunc (c *Configuration) TempDir() string\n```\n\n```go\nfunc (c *Configuration) TusTransfersAllowed() bool\n```\nTusTransfersAllowed returns whether to only use \"tus.io\" HTTP transfers. Default is false, including if the lfs.tustransfers is invalid\n\n```go\nfunc (c *Configuration) UnsetGitGlobalSection(key string) (string, error)\n```\n\n```go\nfunc (c *Configuration) UnsetGitLocalKey(key string) (string, error)\n```\n\n```go\nfunc (c *Configuration) UnsetGitLocalSection(key string) (string, error)\n```\n\n```go\nfunc (c *Configuration) UnsetGitSystemSection(key string) (string, error)\n```\n\n```go\ntype Environment interface {\n\t// Get is shorthand for calling `e.Fetcher.Get(key)`.\n\tGet(key string) (val string, ok bool)\n\n\t// Get is shorthand for calling `e.Fetcher.GetAll(key)`.\n\tGetAll(key string) (vals []string)\n\n\t// Bool returns the boolean state associated with a given key, or the\n\t// value \"def\", if no value was associated.\n\t//\n\t// The \"boolean state associated with a given key\" is defined as the\n\t// case-insensitive string comparison with the following:\n\t//\n\t// 1) true if...\n\t//   \"true\", \"1\", \"on\", \"yes\", or \"t\"\n\t// 2) false if...\n\t//   \"false\", \"0\", \"off\", \"no\", \"f\", or otherwise.\n\tBool(key string, def bool) (val bool)\n\n\t// Int returns the int value associated with a given key, or the value\n\t// \"def\", if no value was associated.\n\t//\n\t// To convert from a the string value attached to a given key,\n\t// `strconv.Atoi(val)` is called. If `Atoi` returned a non-nil error,\n\t// then the value \"def\" will be returned instead.\n\t//\n\t// Otherwise, if the value was converted `string -\u003e int` successfully,\n\t// then it will be returned wholesale.\n\tInt(key string, def int) (val int)\n\n\t// All returns a copy of all the key/value pairs for the current\n\t// environment.\n\tAll() map[string][]string\n}\n```\nAn Environment adds additional behavior to a Fetcher, such a type conversion, and default values.\n\n\\`Environment\\`s are the primary way to communicate with various configuration sources, such as the OS environment variables, the \\`.gitconfig\\`, and even \\`map\\[string]string\\`s.\n\n```go\nfunc EnvironmentOf(f Fetcher) Environment\n```\nEnvironmentOf creates a new \\`Environment\\` initialized with the givne \\`Fetcher\\`, \"f\".\n\n```go\ntype Extension struct {\n\tName     string\n\tClean    string\n\tSmudge   string\n\tPriority int\n}\n```\nAn Extension describes how to manipulate files during smudge and clean. Extensions are parsed from the Git config.\n\n```go\nfunc SortExtensions(m map[string]Extension) ([]Extension, error)\n```\nSortExtensions sorts a map of extensions in ascending order by Priority\n\n```go\ntype Fetcher interface {\n\t// Get returns the string value associated with a given key and a bool\n\t// determining if the key exists.\n\t//\n\t// If multiple entries match the given key, the first one will be\n\t// returned.\n\tGet(key string) (val string, ok bool)\n\n\t// GetAll returns the a set of string values associated with a given\n\t// key. If no entries matched the given key, an empty slice will be\n\t// returned instead.\n\tGetAll(key string) (vals []string)\n\n\t// All returns a copy of all the key/value pairs for the current\n\t// environment.\n\tAll() map[string][]string\n}\n```\nFetcher provides an interface to get typed information out of a configuration \"source\". These sources could be the OS enviornment, a .gitconfig, or even just a \\`map\\`.\n\n```go\nfunc MapFetcher(m map[string][]string) Fetcher\n```\n\n```go\nfunc UniqMapFetcher(m map[string]string) Fetcher\n```\n\n```go\ntype GitFetcher struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (g *GitFetcher) All() map[string][]string\n```\n\n```go\nfunc (g *GitFetcher) Get(key string) (val string, ok bool)\n```\nGet implements the Fetcher interface, and returns the value associated with a given key and true, signaling that the value was present. Otherwise, an empty string and false will be returned, signaling that the value was absent.\n\nMap lookup by key is case-insensitive, as per the .gitconfig specification.\n\nGet is safe to call across multiple goroutines.\n\n```go\nfunc (g *GitFetcher) GetAll(key string) []string\n```\n\n```go\ntype OsFetcher struct {\n\t// contains filtered or unexported fields\n}\n```\nOsFetcher is an implementation of the Fetcher type for communicating with the system's environment.\n\nIt is safe to use across multiple goroutines.\n\n```go\nfunc NewOsFetcher() *OsFetcher\n```\nNewOsFetcher returns a new \\*OsFetcher.\n\n```go\nfunc (o *OsFetcher) All() map[string][]string\n```\n\n```go\nfunc (o *OsFetcher) Get(key string) (val string, ok bool)\n```\nGet returns the value associated with the given key as stored in the local cache, or in the operating system's environment variables.\n\nIf there was a cache-hit, the value will be returned from the cache, skipping a check against os.Getenv. Otherwise, the value will be fetched from the system, stored in the cache, and then returned. If no value was present in the cache or in the system, an empty string will be returned.\n\nGet is safe to call across multiple goroutines.\n\n```go\nfunc (o *OsFetcher) GetAll(key string) []string\n```\nGetAll implements the \\`config.Fetcher.GetAll\\` method by returning, at most, a 1-ary set containing the result of \\`config.OsFetcher.Get()\\`.\n\n```go\ntype URLConfig struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewURLConfig(git Environment) *URLConfig\n```\n\n```go\nfunc (c *URLConfig) Bool(prefix, rawurl, key string, def bool) bool\n```\n\n```go\nfunc (c *URLConfig) Get(prefix, rawurl, key string) (string, bool)\n```\nGet retrieves a \\`http.{url}.{key}\\` for the given key and urls, following the rules in [https://git-scm.com/docs/git-config#git-config-httplturlgt](https://git-scm.com/docs/git-config#git-config-httplturlgt). The value for \\`http.{key}\\` is returned as a fallback if no config keys are set for the given urls.\n\n```go\nfunc (c *URLConfig) GetAll(prefix, rawurl, key string) []string\n```\n\n```go\ntype Values struct {\n\t// Git and Os are the stand-in maps used to provide values for their\n\t// respective environments.\n\tGit, Os map[string][]string\n}\n```\nValues is a convenience type used to call the NewFromValues function. It specifies \\`Git\\` and \\`Env\\` maps to use as mock values, instead of calling out to real \\`.gitconfig\\`s and the \\`os.Getenv\\` function.\n\n","path":"github.com/github/git-media/config","name":"config","synopsis":"Package config collects together all configuration settings NOTE: Subject to change, do not rely on this package from outside git-lfs source","isRedistributable":true}
