3bc100aeb3
This adds support for gitignore-like wildcards and exclude patters in reverse mode. It (somewhat) fixes #273: no regexp support, but the syntax should be powerful enough to satisfy most needs. Also, since adding a lot of --exclude options can be tedious, it adds the --exclude-from option to read patterns from a file (or files).
33 lines
735 B
Go
33 lines
735 B
Go
package fusefrontend_reverse
|
|
|
|
import (
|
|
"github.com/rfjakob/gocryptfs/internal/nametransform"
|
|
)
|
|
|
|
type IgnoreParserMock struct {
|
|
toExclude string
|
|
calledWith string
|
|
}
|
|
|
|
func (parser *IgnoreParserMock) MatchesPath(f string) bool {
|
|
parser.calledWith = f
|
|
return f == parser.toExclude
|
|
}
|
|
|
|
type NameTransformMock struct {
|
|
nametransform.NameTransform
|
|
}
|
|
|
|
func (n *NameTransformMock) DecryptName(cipherName string, iv []byte) (string, error) {
|
|
return "mockdecrypt_" + cipherName, nil
|
|
}
|
|
|
|
func createRFSWithMocks() (*ReverseFS, *IgnoreParserMock) {
|
|
ignorerMock := &IgnoreParserMock{}
|
|
nameTransformMock := &NameTransformMock{}
|
|
var rfs ReverseFS
|
|
rfs.excluder = ignorerMock
|
|
rfs.nameTransform = nameTransformMock
|
|
return &rfs, ignorerMock
|
|
}
|