Skip to content

Commit 2549195

Browse files
committed
Speed up ein t hours even more by optimizing git-mailmap.
1 parent bd8f50b commit 2549195

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

gitoxide-core/src/hours.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::{
88

99
use anyhow::{anyhow, bail};
1010
use git_repository as git;
11-
use git_repository::bstr::{BStr, BString};
11+
use git_repository::bstr::BStr;
1212
use git_repository::{actor, bstr::ByteSlice, interrupt, objs, prelude::*, progress, Progress};
1313
use itertools::Itertools;
1414

@@ -65,21 +65,21 @@ where
6565
for commit_data in rx {
6666
if let Some(author) = objs::CommitRefIter::from_bytes(&commit_data)
6767
.author()
68-
.map(|author| mailmap.resolve(author.trim()))
68+
.map(|author| mailmap.resolve_cow(author.trim()))
6969
.ok()
7070
{
71-
let mut string_ref = |s: &BString| -> &'static BStr {
72-
match string_heap.get(s.as_slice()) {
71+
let mut string_ref = |s: &[u8]| -> &'static BStr {
72+
match string_heap.get(s) {
7373
Some(n) => n.as_bstr(),
7474
None => {
75-
let sv: Vec<u8> = s.clone().into();
75+
let sv: Vec<u8> = s.to_owned().into();
7676
string_heap.insert(Box::leak(sv.into_boxed_slice()));
77-
(*string_heap.get(s.as_slice()).expect("present")).as_ref()
77+
(*string_heap.get(s).expect("present")).as_ref()
7878
}
7979
}
8080
};
81-
let name = string_ref(&author.name);
82-
let email = string_ref(&author.email);
81+
let name = string_ref(author.name.as_ref());
82+
let email = string_ref(&author.email.as_ref());
8383

8484
out.push(actor::SignatureRef {
8585
name,

0 commit comments

Comments
 (0)