--- a/rust/hg-core/src/filepatterns.rs Mon Aug 26 08:25:01 2019 -0400
+++ b/rust/hg-core/src/filepatterns.rs Sun Aug 25 22:53:42 2019 -0400
@@ -185,14 +185,21 @@
res.extend(b"[^/]+$");
res
}
- PatternSyntax::Glob
- | PatternSyntax::RelGlob
- | PatternSyntax::RootGlob => {
+ PatternSyntax::RelGlob => {
let mut res: Vec<u8> = vec![];
- if syntax == PatternSyntax::RelGlob {
+ let glob_re = glob_to_re(pattern);
+ if let Some(rest) = glob_re.drop_prefix(b"[^/]*") {
+ res.extend(b".*");
+ res.extend(rest);
+ } else {
res.extend(b"(?:|.*/)");
+ res.extend(glob_re);
}
-
+ res.extend(globsuffix.iter());
+ res
+ }
+ PatternSyntax::Glob | PatternSyntax::RootGlob => {
+ let mut res: Vec<u8> = vec![];
res.extend(glob_to_re(pattern));
res.extend(globsuffix.iter());
res