github.com/git-lfs/git-lfs@v2.5.2+incompatible/lfs/config.go (about)

     1  package lfs
     2  
     3  import "github.com/git-lfs/git-lfs/config"
     4  
     5  // FetchPruneConfig collects together the config options that control fetching and pruning
     6  type FetchPruneConfig struct {
     7  	// The number of days prior to current date for which (local) refs other than HEAD
     8  	// will be fetched with --recent (default 7, 0 = only fetch HEAD)
     9  	FetchRecentRefsDays int
    10  	// Makes the FetchRecentRefsDays option apply to remote refs from fetch source as well (default true)
    11  	FetchRecentRefsIncludeRemotes bool
    12  	// number of days prior to latest commit on a ref that we'll fetch previous
    13  	// LFS changes too (default 0 = only fetch at ref)
    14  	FetchRecentCommitsDays int
    15  	// Whether to always fetch recent even without --recent
    16  	FetchRecentAlways bool
    17  	// Number of days added to FetchRecent*; data outside combined window will be
    18  	// deleted when prune is run. (default 3)
    19  	PruneOffsetDays int
    20  	// Always verify with remote before pruning
    21  	PruneVerifyRemoteAlways bool
    22  	// Name of remote to check for unpushed and verify checks
    23  	PruneRemoteName string
    24  }
    25  
    26  func NewFetchPruneConfig(git config.Environment) FetchPruneConfig {
    27  	pruneRemote, _ := git.Get("lfs.pruneremotetocheck")
    28  	if len(pruneRemote) == 0 {
    29  		pruneRemote = "origin"
    30  	}
    31  
    32  	return FetchPruneConfig{
    33  		FetchRecentRefsDays:           git.Int("lfs.fetchrecentrefsdays", 7),
    34  		FetchRecentRefsIncludeRemotes: git.Bool("lfs.fetchrecentremoterefs", true),
    35  		FetchRecentCommitsDays:        git.Int("lfs.fetchrecentcommitsdays", 0),
    36  		FetchRecentAlways:             git.Bool("lfs.fetchrecentalways", false),
    37  		PruneOffsetDays:               git.Int("lfs.pruneoffsetdays", 3),
    38  		PruneVerifyRemoteAlways:       git.Bool("lfs.pruneverifyremotealways", false),
    39  		PruneRemoteName:               pruneRemote,
    40  	}
    41  }