Skip to content

Commit ca05471

Browse files
committed
fix: allow mailmaps to change the email by name and email (#1417)
1 parent 8802c55 commit ca05471

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

gix-mailmap/src/entry.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,24 @@ impl<'a> Entry<'a> {
2525
/// Constructors indicating what kind of mapping is created.
2626
///
2727
/// Only these combinations of values are valid.
28-
#[allow(missing_docs)]
2928
impl<'a> Entry<'a> {
29+
/// An entry that changes the name by an email.
3030
pub fn change_name_by_email(proper_name: impl Into<&'a BStr>, commit_email: impl Into<&'a BStr>) -> Self {
3131
Entry {
3232
new_name: Some(proper_name.into()),
3333
old_email: commit_email.into(),
3434
..Default::default()
3535
}
3636
}
37+
/// An entry that changes the email by an email.
3738
pub fn change_email_by_email(proper_email: impl Into<&'a BStr>, commit_email: impl Into<&'a BStr>) -> Self {
3839
Entry {
3940
new_email: Some(proper_email.into()),
4041
old_email: commit_email.into(),
4142
..Default::default()
4243
}
4344
}
45+
/// An entry that changes the email by a name and email.
4446
pub fn change_email_by_name_and_email(
4547
proper_email: impl Into<&'a BStr>,
4648
commit_name: impl Into<&'a BStr>,
@@ -53,6 +55,7 @@ impl<'a> Entry<'a> {
5355
..Default::default()
5456
}
5557
}
58+
/// An entry that changes a name and the email by an email.
5659
pub fn change_name_and_email_by_email(
5760
proper_name: impl Into<&'a BStr>,
5861
proper_email: impl Into<&'a BStr>,
@@ -65,7 +68,7 @@ impl<'a> Entry<'a> {
6568
..Default::default()
6669
}
6770
}
68-
71+
/// An entry that changes a name and email by a name and email.
6972
pub fn change_name_and_email_by_name_and_email(
7073
proper_name: impl Into<&'a BStr>,
7174
proper_email: impl Into<&'a BStr>,

gix-mailmap/src/parse.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ fn parse_line(line: &BStr, line_number: usize) -> Result<Entry<'_>, Error> {
7777
(Some(proper_name), Some(proper_email), Some(commit_name), Some(commit_email)) => {
7878
Entry::change_name_and_email_by_name_and_email(proper_name, proper_email, commit_name, commit_email)
7979
}
80+
(None, Some(proper_email), Some(commit_name), Some(commit_email)) => {
81+
Entry::change_email_by_name_and_email(proper_email, commit_name, commit_email)
82+
}
8083
_ => {
8184
return Err(Error::Malformed {
8285
line_number,

0 commit comments

Comments
 (0)