rust/hg-core/src/matchers.rs
branchstable
changeset 44762 b15a37d85dbe
parent 44604 e62052d0f377
child 44911 fd3b94f1712d
equal deleted inserted replaced
44761:ee0790b67c45 44762:b15a37d85dbe
   356     // # Safety
   356     // # Safety
   357     // This is safe because we escaped all non-ASCII bytes.
   357     // This is safe because we escaped all non-ASCII bytes.
   358     let pattern_string = unsafe { String::from_utf8_unchecked(escaped_bytes) };
   358     let pattern_string = unsafe { String::from_utf8_unchecked(escaped_bytes) };
   359     let re = regex::bytes::RegexBuilder::new(&pattern_string)
   359     let re = regex::bytes::RegexBuilder::new(&pattern_string)
   360         .unicode(false)
   360         .unicode(false)
       
   361         // Big repos with big `.hgignore` will hit the default limit and
       
   362         // incur a significant performance hit. One repo's `hg status` hit
       
   363         // multiple *minutes*.
       
   364         .dfa_size_limit(50 * (1 << 20))
   361         .build()
   365         .build()
   362         .map_err(|e| PatternError::UnsupportedSyntax(e.to_string()))?;
   366         .map_err(|e| PatternError::UnsupportedSyntax(e.to_string()))?;
   363 
   367 
   364     Ok(move |path: &HgPath| re.is_match(path.as_bytes()))
   368     Ok(move |path: &HgPath| re.is_match(path.as_bytes()))
   365 }
   369 }