Skip to content

Commit fb4d449

Browse files
committed
Remove additional deduplication of contributors by email
1 parent b9b65c7 commit fb4d449

File tree

1 file changed

+2
-51
lines changed

1 file changed

+2
-51
lines changed

Diff for: src/info/repo.rs

+2-51
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use git2::{Repository, RepositoryOpenFlags, Status, StatusOptions, StatusShow};
66
use git_repository as git;
77
use git_repository::bstr::ByteSlice;
88
use regex::Regex;
9-
use std::cmp::Ordering;
109
use std::collections::HashMap;
1110
use std::path::Path;
1211
use time::format_description::well_known::Rfc3339;
@@ -26,63 +25,15 @@ pub struct Repo<'a> {
2625
time_of_first_commit: git::actor::Time,
2726
}
2827

28+
#[derive(Hash, PartialOrd, Ord, Eq, PartialEq)]
2929
pub struct Sig {
3030
name: git::bstr::BString,
3131
email: git::bstr::BString,
32-
email_lowercase: Option<String>,
3332
}
3433

3534
impl From<git::actor::Signature> for Sig {
3635
fn from(git::actor::Signature { name, email, .. }: git::actor::Signature) -> Self {
37-
let needs_lowercase = email.chars().any(|c| c.to_ascii_lowercase() != c);
38-
let email_lowercase = needs_lowercase.then(|| email.chars().collect::<String>());
39-
Self {
40-
name,
41-
email,
42-
email_lowercase,
43-
}
44-
}
45-
}
46-
47-
impl std::hash::Hash for Sig {
48-
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
49-
self.email_lowercase
50-
.as_ref()
51-
.map(|email_lc| email_lc.hash(state))
52-
.unwrap_or_else(|| self.email.hash(state));
53-
self.name.hash(state);
54-
}
55-
}
56-
57-
impl Eq for Sig {}
58-
59-
impl PartialEq<Self> for Sig {
60-
fn eq(&self, other: &Self) -> bool {
61-
self.cmp(other) == Ordering::Equal
62-
}
63-
}
64-
65-
impl PartialOrd<Self> for Sig {
66-
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
67-
self.cmp(other).into()
68-
}
69-
}
70-
71-
impl Ord for Sig {
72-
fn cmp(&self, other: &Self) -> Ordering {
73-
self.email_lowercase
74-
.as_ref()
75-
.and_then(|a_email_lc| {
76-
other
77-
.email_lowercase
78-
.as_ref()
79-
.map(|b_email_lc| (a_email_lc, b_email_lc))
80-
})
81-
.map_or_else(
82-
|| self.email.cmp(&other.email),
83-
|(a_email_lc, b_email_lc)| a_email_lc.cmp(b_email_lc),
84-
)
85-
.then_with(|| self.name.cmp(&other.name))
36+
Self { name, email }
8637
}
8738
}
8839

0 commit comments

Comments
 (0)