git-lfs/lfs/config.go
Chris Darroch dd8e306e31 all: update go.mod module path with explicit v2
When our go.mod file was introduced in commit
114e85c2002091eb415040923d872f8e4a4bc636 in PR #3208, the module
path chosen did not include a trailing /v2 component.  However,
the Go modules specification now advises that module paths must
have a "major version suffix" which matches the release version.

We therefore add a /v2 suffix to our module path and all its
instances in import paths.

See also https://golang.org/ref/mod#major-version-suffixes for
details regarding the Go module system's major version suffix rule.
2021-08-09 23:18:38 -07:00

48 lines
1.9 KiB
Go

package lfs
import "github.com/git-lfs/git-lfs/v2/config"
// FetchPruneConfig collects together the config options that control fetching and pruning
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
// Whether to ignore all recent options.
PruneRecent bool
// Whether to delete everything pushed.
PruneForce bool
}
func NewFetchPruneConfig(git config.Environment) FetchPruneConfig {
pruneRemote, _ := git.Get("lfs.pruneremotetocheck")
if len(pruneRemote) == 0 {
pruneRemote = "origin"
}
return FetchPruneConfig{
FetchRecentRefsDays: git.Int("lfs.fetchrecentrefsdays", 7),
FetchRecentRefsIncludeRemotes: git.Bool("lfs.fetchrecentremoterefs", true),
FetchRecentCommitsDays: git.Int("lfs.fetchrecentcommitsdays", 0),
FetchRecentAlways: git.Bool("lfs.fetchrecentalways", false),
PruneOffsetDays: git.Int("lfs.pruneoffsetdays", 3),
PruneVerifyRemoteAlways: git.Bool("lfs.pruneverifyremotealways", false),
PruneRemoteName: pruneRemote,
PruneRecent: false,
PruneForce: false,
}
}