Open c0d3z3r0 opened 8 years ago
Well, what you describe in first paragraph is not necessarily a bug or anything unexpected. "/" is the separator and only there if there is something after it to separate. Only exception: "/" (root directory).
In general, changes of matching behaviour are problematic: some peoples backups will change behaviour, things may go wrong.
there could be a new type of matcher that ensures tailing slashes for folders in regex matches
Hmm... maybe not a complete new matcher but what about matcher options like "re:d:^/blah/blah/" where d means "differentiate between files and dirs"?
there are no matcher options, so a new matcher type ^^ also the pre behaviour is new (after all it needs to ensure the folder prefix)
Borg does not differentiate between files an folders in excludes and so 're:^/testdir/test' matches for a directory "test" but also for a file "test". 're:^/testdir/test/' (notice the trailing slash) would not match anything. Since borg already checks if the path is a file or folder - which we can see in the output as d or any of b, c, h, s and f - it should able to make a difference between 're:^/testdir/test' which is a file match and 're:^/testdir/test/' (notice the trailing slash) representing a directory match.
I quickly looked into the code and found "os.path.normpath" which also removes trailing slashes from paths; maybe that could be changed somehow...