Rename excludeByFile -> rejectIfPresent

This commit is contained in:
Alexander Neumann 2017-09-10 14:25:58 +02:00
parent a9c705009c
commit 4a0129fc2b
2 changed files with 3 additions and 3 deletions

View file

@ -427,7 +427,7 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, args []string) error {
var excludesByFile []RejectFunc var excludesByFile []RejectFunc
for _, spec := range opts.ExcludeIfPresent { for _, spec := range opts.ExcludeIfPresent {
f, err := excludeByFile(spec) f, err := rejectIfPresent(spec)
if err != nil { if err != nil {
return err return err
} }

View file

@ -17,12 +17,12 @@ import (
// should be excluded (rejected) from the backup. // should be excluded (rejected) from the backup.
type RejectFunc func(filename string, fi os.FileInfo) bool type RejectFunc func(filename string, fi os.FileInfo) bool
// excludeByFile returns a RejectFunc which itself returns whether a path // rejectIfPresent returns a RejectFunc which itself returns whether a path
// should be excluded. The RejectFunc considers a file to be excluded when // should be excluded. The RejectFunc considers a file to be excluded when
// it resides in a directory with an exclusion file, that is specified by // it resides in a directory with an exclusion file, that is specified by
// excludeFileSpec in the form "filename[:content]". The returned error is // excludeFileSpec in the form "filename[:content]". The returned error is
// non-nil if the filename component of excludeFileSpec is empty. // non-nil if the filename component of excludeFileSpec is empty.
func excludeByFile(excludeFileSpec string) (RejectFunc, error) { func rejectIfPresent(excludeFileSpec string) (RejectFunc, error) {
if excludeFileSpec == "" { if excludeFileSpec == "" {
return func(string, os.FileInfo) bool { return false }, nil return func(string, os.FileInfo) bool { return false }, nil
} }