Expand description
Parse .mailmap files as used in git repositories and remap names and emails using an accelerated data-structure.
§Examples
use gix_actor::SignatureRef;
let input = b"
Joe R. Developer <joe@example.com> <bugs@example.com>
Jane Doe <jane@example.com> Jane <bugs@example.com>
";
let parsed = gix_mailmap::parse(input)
.collect::<Result<Vec<_>, _>>()
.unwrap();
assert_eq!(parsed.len(), 2);
let snapshot = gix_mailmap::Snapshot::new(parsed);
let resolved = snapshot.resolve(
SignatureRef::from_bytes(b"Jane <bugs@example.com> 1711398853 +0800").unwrap(),
);
assert_eq!(resolved.name, "Jane Doe");
assert_eq!(resolved.email, "jane@example.com");§Feature Flags
serde— Data structures implementserde::Serializeandserde::Deserialize.
Modules§
Structs§
- Entry
- An typical entry of a mailmap, which always contains an
old_emailby which the mapping is performed to replace the givennew_nameandnew_email. - Snapshot
- A data-structure to efficiently store a list of entries for optimal, case-insensitive lookup by email and optionally name to find mappings to new names and/or emails.
Functions§
- parse
- Parse the given
bufof bytes line by line into mapping Entries. - parse_
ignore_ errors - Similar to parse(), but will skip all lines that didn’t parse correctly, silently squelching all errors.