Skip to content

Commit beb478f

Browse files
committed
simplify estimate-hours by just looking at the author signature (#364)
This results in one less name counted in the linux kernel, which probably means that one name (maybe a bot) was used to commit a commit. That's acceptable inaccuracy.
1 parent a39bf71 commit beb478f

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

gitoxide-core/src/hours.rs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,27 +85,13 @@ where
8585
#[allow(clippy::redundant_closure)]
8686
let mut all_commits: Vec<actor::Signature> = all_commits
8787
.into_par_iter()
88-
.map(|commit_data: Vec<u8>| {
88+
.filter_map(|commit_data: Vec<u8>| {
8989
objs::CommitRefIter::from_bytes(&commit_data)
90-
.signatures()
91-
.next()
92-
.map(|author| mailmap.resolve(author))
90+
.author()
91+
.map(|author| mailmap.resolve(author.trim()))
92+
.ok()
9393
})
94-
.try_fold(
95-
|| Vec::new(),
96-
|mut out: Vec<_>, item| {
97-
out.push(item?);
98-
Some(out)
99-
},
100-
)
101-
.try_reduce(
102-
|| Vec::new(),
103-
|mut out, vec| {
104-
out.extend(vec.into_iter());
105-
Some(out)
106-
},
107-
)
108-
.ok_or_else(|| anyhow!("An error occurred when decoding commits - one commit could not be parsed"))?;
94+
.collect::<Vec<_>>();
10995
all_commits.sort_by(|a, b| {
11096
a.email.cmp(&b.email).then(
11197
a.time

0 commit comments

Comments
 (0)