# HG changeset patch # User Spencer Baugh # Date 1690984789 14400 # Node ID 2b4bcdc948e78220e8e23425c964d74c3f0c8f23 # Parent df6dfad5009a700155ba5ec25b3b10b149308a3a rust: don't escape spaces in regex Spaces are not in fact a regex special character, and escaping them is not correct. diff -r df6dfad5009a -r 2b4bcdc948e7 rust/hg-core/src/filepatterns.rs --- a/rust/hg-core/src/filepatterns.rs Wed Aug 02 10:09:23 2023 -0400 +++ b/rust/hg-core/src/filepatterns.rs Wed Aug 02 09:59:49 2023 -0400 @@ -24,7 +24,7 @@ lazy_static! { static ref RE_ESCAPE: Vec> = { let mut v: Vec> = (0..=255).map(|byte| vec![byte]).collect(); - let to_escape = b"()[]{}?*+-|^$\\.&~# \t\n\r\x0b\x0c"; + let to_escape = b"()[]{}?*+-|^$\\.&~#\t\n\r\x0b\x0c"; for byte in to_escape { v[*byte as usize].insert(0, b'\\'); } @@ -641,8 +641,8 @@ assert_eq!(escape_pattern(untouched), untouched.to_vec()); // All escape codes assert_eq!( - escape_pattern(br#"()[]{}?*+-|^$\\.&~# \t\n\r\v\f"#), - br#"\(\)\[\]\{\}\?\*\+\-\|\^\$\\\\\.\&\~\#\ \\t\\n\\r\\v\\f"# + escape_pattern(br#"()[]{}?*+-|^$\\.&~#\t\n\r\v\f"#), + br#"\(\)\[\]\{\}\?\*\+\-\|\^\$\\\\\.\&\~\#\\t\\n\\r\\v\\f"# .to_vec() ); }