mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 14:56:29 +00:00
Cleanup exclude pattern collection
This commit is contained in:
parent
537cfe2e4c
commit
bb0fa76c06
@ -306,7 +306,7 @@ func collectRejectByNameFuncs(opts BackupOptions, repo *repository.Repository, t
|
|||||||
fs = append(fs, f)
|
fs = append(fs, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
fsPatterns, err := collectExcludePatterns(opts.excludePatternOptions)
|
fsPatterns, err := opts.excludePatternOptions.CollectPatterns()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -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())
|
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 {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
@ -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
|
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
|
var fs []RejectByNameFunc
|
||||||
// add patterns from file
|
// add patterns from file
|
||||||
if len(opts.ExcludeFiles) > 0 {
|
if len(opts.ExcludeFiles) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user