Documentation ¶
Overview ¶
Package config collects together all configuration settings NOTE: Subject to change, do not rely on this package from outside git-lfs source
Index ¶
- Constants
- Variables
- func ResolveGitBasicDirs()
- type Configuration
- func (c *Configuration) Access(operation string) string
- func (c *Configuration) AllGitConfig() map[string]string
- func (c *Configuration) BasicTransfersOnly() bool
- func (c *Configuration) BatchTransfer() bool
- func (c *Configuration) ClearConfig()
- func (c *Configuration) ConcurrentTransfers() int
- func (c *Configuration) Endpoint(operation string) Endpoint
- func (c *Configuration) EndpointAccess(e Endpoint) string
- func (c *Configuration) Extensions() map[string]Extension
- func (c *Configuration) FetchExcludePaths() []string
- func (c *Configuration) FetchIncludePaths() []string
- func (c *Configuration) FetchPruneConfig() *FetchPruneConfig
- func (c *Configuration) FindNetrcHost(host string) (*netrc.Machine, error)
- func (c *Configuration) GetAllEnv() map[string]string
- func (c *Configuration) Getenv(key string) string
- func (c *Configuration) GetenvBool(key string, def bool) bool
- func (c *Configuration) GitConfig(key string) (string, bool)
- func (c *Configuration) GitConfigBool(key string, def bool) bool
- func (c *Configuration) GitConfigInt(key string, def int) int
- func (c *Configuration) GitProtocol() string
- func (c *Configuration) GitRemoteUrl(remote string, forpush bool) string
- func (c *Configuration) NtlmAccess(operation string) bool
- func (c *Configuration) PrivateAccess(operation string) bool
- func (c *Configuration) RemoteEndpoint(remote, operation string) Endpoint
- func (c *Configuration) Remotes() []string
- func (c *Configuration) ResetConfig()
- func (c *Configuration) SetAccess(operation string, authType string)
- func (c *Configuration) SetAllEnv(env map[string]string)
- func (c *Configuration) SetConfig(key, value string)
- func (c *Configuration) SetEndpointAccess(e Endpoint, authType string)
- func (c *Configuration) SetManualEndpoint(e Endpoint)
- func (c *Configuration) SetNetrc(n netrcfinder)
- func (c *Configuration) Setenv(key, value string) error
- func (c *Configuration) SkipDownloadErrors() bool
- func (c *Configuration) SortedExtensions() ([]Extension, error)
- func (c *Configuration) TusTransfersAllowed() bool
- type Endpoint
- type Extension
- type FetchPruneConfig
Constants ¶
const EndpointUrlUnknown = "<unknown>"
Variables ¶
var ( Config = New() ShowConfigWarnings = false )
var ( LocalWorkingDir string LocalGitDir string // parent of index / config / hooks etc LocalGitStorageDir string // parent of objects/lfs (may be same as LocalGitDir but may not) LocalReferenceDir string // alternative local media dir (relative to clone reference repo) LocalLogDir string )
var ( GitCommit string Version = "1.3.1" VersionDesc string )
Functions ¶
func ResolveGitBasicDirs ¶
func ResolveGitBasicDirs()
Determins the LocalWorkingDir, LocalGitDir etc
Types ¶
type Configuration ¶
type Configuration struct { CurrentRemote string NtlmSession ntlm.ClientSession IsTracingHttp bool IsDebuggingHttp bool IsLoggingStats bool // contains filtered or unexported fields }
func New ¶ added in v1.3.1
func New() *Configuration
func NewFromValues ¶
func NewFromValues(gitconfig map[string]string) *Configuration
NewFromValues returns a new *config.Configuration instance as if it had been read from the .gitconfig specified by "gitconfig" parameter.
NOTE: this method should only be called during testing.
func (*Configuration) Access ¶
func (c *Configuration) Access(operation string) string
Access returns the access auth type.
func (*Configuration) AllGitConfig ¶
func (c *Configuration) AllGitConfig() map[string]string
func (*Configuration) BasicTransfersOnly ¶
func (c *Configuration) BasicTransfersOnly() bool
BasicTransfersOnly returns whether to only allow "basic" HTTP transfers. Default is false, including if the lfs.basictransfersonly is invalid
func (*Configuration) BatchTransfer ¶
func (c *Configuration) BatchTransfer() bool
func (*Configuration) ClearConfig ¶
func (c *Configuration) ClearConfig()
func (*Configuration) ConcurrentTransfers ¶
func (c *Configuration) ConcurrentTransfers() int
func (*Configuration) Endpoint ¶
func (c *Configuration) Endpoint(operation string) Endpoint
func (*Configuration) EndpointAccess ¶
func (c *Configuration) EndpointAccess(e Endpoint) string
func (*Configuration) Extensions ¶
func (c *Configuration) Extensions() map[string]Extension
func (*Configuration) FetchExcludePaths ¶
func (c *Configuration) FetchExcludePaths() []string
func (*Configuration) FetchIncludePaths ¶
func (c *Configuration) FetchIncludePaths() []string
func (*Configuration) FetchPruneConfig ¶
func (c *Configuration) FetchPruneConfig() *FetchPruneConfig
func (*Configuration) FindNetrcHost ¶
func (c *Configuration) FindNetrcHost(host string) (*netrc.Machine, error)
func (*Configuration) GetAllEnv ¶
func (c *Configuration) GetAllEnv() map[string]string
func (*Configuration) Getenv ¶
func (c *Configuration) Getenv(key string) string
func (*Configuration) GetenvBool ¶
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) GitConfigBool ¶
func (c *Configuration) GitConfigBool(key string, def bool) bool
GitConfigBool parses a git config value and returns true if defined as true, 1, on, yes, or def if not defined
func (*Configuration) GitConfigInt ¶
func (c *Configuration) GitConfigInt(key string, def int) int
GitConfigInt parses a git config value and returns it as an integer.
func (*Configuration) GitProtocol ¶
func (c *Configuration) GitProtocol() string
GitProtocol returns the protocol for the LFS API when converting from a git:// remote url.
func (*Configuration) GitRemoteUrl ¶
func (c *Configuration) GitRemoteUrl(remote string, forpush bool) string
GitRemoteUrl returns the git clone/push url for a given remote (blank if not found) the forpush argument is to cater for separate remote.name.pushurl settings
func (*Configuration) NtlmAccess ¶
func (c *Configuration) NtlmAccess(operation string) bool
func (*Configuration) PrivateAccess ¶
func (c *Configuration) PrivateAccess(operation string) 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, operation string) Endpoint
func (*Configuration) Remotes ¶
func (c *Configuration) Remotes() []string
func (*Configuration) ResetConfig ¶
func (c *Configuration) ResetConfig()
func (*Configuration) SetAccess ¶
func (c *Configuration) SetAccess(operation string, authType string)
SetAccess will set the private access flag in .git/config.
func (*Configuration) SetAllEnv ¶
func (c *Configuration) SetAllEnv(env map[string]string)
func (*Configuration) SetConfig ¶
func (c *Configuration) SetConfig(key, value string)
only used for tests
func (*Configuration) SetEndpointAccess ¶
func (c *Configuration) SetEndpointAccess(e Endpoint, authType string)
func (*Configuration) SetManualEndpoint ¶
func (c *Configuration) SetManualEndpoint(e Endpoint)
Manually set an Endpoint to use instead of deriving from Git config
func (*Configuration) SetNetrc ¶
func (c *Configuration) SetNetrc(n netrcfinder)
Manually override the netrc config
func (*Configuration) Setenv ¶
func (c *Configuration) Setenv(key, value string) error
func (*Configuration) SkipDownloadErrors ¶
func (c *Configuration) SkipDownloadErrors() bool
func (*Configuration) SortedExtensions ¶
func (c *Configuration) SortedExtensions() ([]Extension, error)
SortedExtensions gets the list of extensions ordered by Priority
func (*Configuration) TusTransfersAllowed ¶
func (c *Configuration) TusTransfersAllowed() bool
TusTransfersAllowed returns whether to only use "tus.io" HTTP transfers. Default is false, including if the lfs.tustransfers is invalid
type Endpoint ¶
An Endpoint describes how to access a Git LFS server.
func NewEndpoint ¶
NewEndpoint initializes a new Endpoint for a given URL.
func NewEndpointFromCloneURL ¶
NewEndpointFromCloneURL creates an Endpoint from a git clone URL by appending "[.git]/info/lfs".
func NewEndpointFromCloneURLWithConfig ¶
func NewEndpointFromCloneURLWithConfig(url string, c *Configuration) Endpoint
NewEndpointFromCloneURLWithConfig creates an Endpoint from a git clone URL by appending "[.git]/info/lfs".
func NewEndpointWithConfig ¶
func NewEndpointWithConfig(rawurl string, c *Configuration) Endpoint
NewEndpointWithConfig initializes a new Endpoint for a given URL.
type Extension ¶
An Extension describes how to manipulate files during smudge and clean. Extensions are parsed from the Git config.
type FetchPruneConfig ¶
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 // Always verify with remote before pruning PruneVerifyRemoteAlways bool // Name of remote to check for unpushed and verify checks PruneRemoteName string }
FetchPruneConfig collects together the config options that control fetching and pruning