Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: add
case_sensitive
option to some revsets
Add support for case‐insensitive matching to `description(pattern)`, `author(pattern)`, and `committer(pattern)`, partially resolving a 1.5‐year‐old TODO comment, and make `mine()` use it unconditionally. This is a function argument rather than part of the pattern syntax as it doesn’t make sense for all uses of patterns to support case‐sensitivity (e.g. Git branch settings, where the remote end has no support for case‐insensitive matching), and it’s not clear how it would best be integrated into the pattern syntax anyway. The `glob` and `regex` crates also separate matching options like this from the pattern itself. Case‐insensitivity is on by default; a casual search for commit names or descriptions is unlikely to care about specific case distinctions, the domain part of email addresses is de jure case‐insensitive, and the local‐part is case‐insensitive in practice too. This could be changed at a later date if it turns out to be undesirable default for any of these functions (`description("FIXME")`?). This currently only handles ASCII case folding, due to the complexities of case‐insensitive Unicode comparison and the `glob` crate’s lack of support for it. This is unlikely to matter for email addresses, which very rarely contain non‐ASCII characters, but is unfortunate for names and descriptions. However, the current matching behaviour is already seriously deficient for non‐ASCII text due to the lack of any normalization, so this hopefully shouldn’t be a blocker to adding the interface. An expository comment has been left in the code for anyone who wants to try and address this (perhaps a future version of myself).
- Loading branch information