|
@@ -119,10 +119,11 @@ def convert_glob_patterns_to_borg_pattern(patterns):
|
|
|
Convert a sequence of shell glob patterns like "/etc/*", "/tmp/*" to the corresponding Borg
|
|
|
regular expression archive pattern as a single string like "re:etc/.*|tmp/.*".
|
|
|
'''
|
|
|
- # Remove the "\Z" generated by fnmatch.translate() because we don't want the pattern to match
|
|
|
- # only at the end of a path, as directory format dumps require extracting files with paths
|
|
|
+ # Remove the "\z" or "\Z" generated by fnmatch.translate() because we don't want the pattern to
|
|
|
+ # match only at the end of a path, as directory format dumps require extracting files with paths
|
|
|
# longer than the pattern. E.g., a pattern of "borgmatic/*/foo_databases/test" should also match
|
|
|
# paths like "borgmatic/*/foo_databases/test/toc.dat"
|
|
|
return 're:' + '|'.join(
|
|
|
- fnmatch.translate(pattern.lstrip('/')).replace('\\Z', '') for pattern in patterns
|
|
|
+ fnmatch.translate(pattern.lstrip('/')).replace('\\z', '').replace('\\Z', '')
|
|
|
+ for pattern in patterns
|
|
|
)
|