Skip to content

Commit f59a794

Browse files
committed
Make use of gix_traverse::commit::Either::commit_time()
This removes a local implementation of it.
1 parent b40ba17 commit f59a794

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

gix-blame/src/file/function.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,9 @@ pub fn file(
106106

107107
let (mut buf, mut buf2) = (Vec::new(), Vec::new());
108108
let commit = find_commit(cache.as_ref(), &odb, &suspect, &mut buf)?;
109-
let mut queue: gix_revwalk::PriorityQueue<CommitTime, ObjectId> = gix_revwalk::PriorityQueue::new();
110-
queue.insert(commit_time(commit)?, suspect);
109+
let mut queue: gix_revwalk::PriorityQueue<gix_date::SecondsSinceUnixEpoch, ObjectId> =
110+
gix_revwalk::PriorityQueue::new();
111+
queue.insert(commit.commit_time()?, suspect);
111112

112113
let mut out = Vec::new();
113114
let mut diff_state = gix_diff::tree::State::default();
@@ -126,7 +127,7 @@ pub fn file(
126127
}
127128

128129
let commit = find_commit(cache.as_ref(), &odb, &suspect, &mut buf)?;
129-
let commit_time = commit_time(commit)?;
130+
let commit_time = commit.commit_time()?;
130131

131132
if let Some(since) = options.since {
132133
if commit_time < since.seconds {
@@ -651,17 +652,6 @@ fn find_path_entry_in_commit(
651652
Ok(res.map(|e| e.oid))
652653
}
653654

654-
type CommitTime = i64;
655-
656-
fn commit_time(commit: gix_traverse::commit::Either<'_, '_>) -> Result<CommitTime, gix_object::decode::Error> {
657-
match commit {
658-
gix_traverse::commit::Either::CommitRefIter(commit_ref_iter) => {
659-
commit_ref_iter.committer().map(|c| c.seconds())
660-
}
661-
gix_traverse::commit::Either::CachedCommit(commit) => Ok(commit.committer_timestamp() as i64),
662-
}
663-
}
664-
665655
type ParentIds = SmallVec<[(gix_hash::ObjectId, i64); 2]>;
666656

667657
fn collect_parents(

0 commit comments

Comments
 (0)