Skip to content

Commit

Permalink
Cleanup exclude pattern collection
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelEischer committed Nov 12, 2022
1 parent 537cfe2 commit bb0fa76
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/restic/cmd_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/restic/cmd_rewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/restic/exclude.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit bb0fa76

Please sign in to comment.