Cleanup exclude pattern collection

This commit is contained in:
Michael Eischer 2022-11-12 19:54:52 +01:00
parent 537cfe2e4c
commit bb0fa76c06
3 changed files with 3 additions and 3 deletions

View file

@ -306,7 +306,7 @@ func collectRejectByNameFuncs(opts BackupOptions, repo *repository.Repository, t
fs = append(fs, f)
}
fsPatterns, err := collectExcludePatterns(opts.excludePatternOptions)
fsPatterns, err := opts.excludePatternOptions.CollectPatterns()
if err != nil {
return nil, err
}

View file

@ -73,7 +73,7 @@ func rewriteSnapshot(ctx context.Context, repo *repository.Repository, sn *resti
return false, errors.Errorf("snapshot %v has nil tree", sn.ID().Str())
}
rejectByNameFuncs, err := collectExcludePatterns(opts.excludePatternOptions)
rejectByNameFuncs, err := opts.excludePatternOptions.CollectPatterns()
if err != nil {
return false, err
}

View file

@ -479,7 +479,7 @@ func (opts *excludePatternOptions) Empty() bool {
return len(opts.Excludes) == 0 && len(opts.InsensitiveExcludes) == 0 && len(opts.ExcludeFiles) == 0 && len(opts.InsensitiveExcludeFiles) == 0
}
func collectExcludePatterns(opts excludePatternOptions) ([]RejectByNameFunc, error) {
func (opts excludePatternOptions) CollectPatterns() ([]RejectByNameFunc, error) {
var fs []RejectByNameFunc
// add patterns from file
if len(opts.ExcludeFiles) > 0 {