Skip to content

Commit f4b0195

Browse files
committed
change!: Remove custom graph::CommitterTimestamp in favor of gix-date::SecondsSinceUnixEpoch.
After all, these are meant to be the same.
1 parent b785e81 commit f4b0195

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gix-revwalk/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ doctest = false
1515
[dependencies]
1616
gix-hash = { version = "^0.11.2", path = "../gix-hash" }
1717
gix-object = { version = "^0.30.0", path = "../gix-object" }
18+
gix-date = { version = "^0.5.1", path = "../gix-date" }
1819
gix-hashtable = { version = "^0.2.1", path = "../gix-hashtable" }
1920
gix-commitgraph = { version = "^0.16.0", path = "../gix-commitgraph" }
2021

gix-revwalk/src/graph/commit.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
use gix_date::SecondsSinceUnixEpoch;
12
use smallvec::SmallVec;
23

34
use super::LazyCommit;
4-
use crate::graph::{Commit, CommitterTimestamp, Either, Generation};
5+
use crate::graph::{Commit, Either, Generation};
56

67
impl<'graph> LazyCommit<'graph> {
78
/// Return an iterator over the parents of this commit.
@@ -17,11 +18,9 @@ impl<'graph> LazyCommit<'graph> {
1718
///
1819
/// This is the single-most important date for determining recency of commits.
1920
/// Note that this can only fail if the commit is backed by the object database *and* parsing fails.
20-
pub fn committer_timestamp(&self) -> Result<CommitterTimestamp, gix_object::decode::Error> {
21+
pub fn committer_timestamp(&self) -> Result<SecondsSinceUnixEpoch, gix_object::decode::Error> {
2122
Ok(match &self.backing {
22-
Either::Left(buf) => {
23-
gix_object::CommitRefIter::from_bytes(buf).committer()?.time.seconds as CommitterTimestamp
24-
}
23+
Either::Left(buf) => gix_object::CommitRefIter::from_bytes(buf).committer()?.time.seconds,
2524
Either::Right((cache, pos)) => cache.commit_at(*pos).committer_timestamp(),
2625
})
2726
}
@@ -50,7 +49,7 @@ impl<'graph> LazyCommit<'graph> {
5049
Token::Parent { id } => parents.push(id),
5150
Token::Author { .. } => {}
5251
Token::Committer { signature } => {
53-
timestamp = Some(signature.time.seconds as CommitterTimestamp);
52+
timestamp = Some(signature.time.seconds);
5453
break;
5554
}
5655
_ => {

gix-revwalk/src/graph/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ pub mod commit;
1010

1111
mod errors;
1212
pub use errors::{insert_parents, lookup};
13-
14-
/// The time in seconds since unix epoch at which a commit was created.
15-
pub type CommitterTimestamp = u64;
13+
use gix_date::SecondsSinceUnixEpoch;
1614

1715
/// The generation away from the HEAD of graph, useful to limit algorithms by topological depth as well.
1816
///
@@ -74,7 +72,7 @@ impl<'find, T> Graph<'find, T> {
7472
pub fn insert_parents(
7573
&mut self,
7674
id: &gix_hash::oid,
77-
mut new_parent_data: impl FnMut(gix_hash::ObjectId, CommitterTimestamp) -> T,
75+
mut new_parent_data: impl FnMut(gix_hash::ObjectId, SecondsSinceUnixEpoch) -> T,
7876
mut update_existing: impl FnMut(gix_hash::ObjectId, &mut T),
7977
first_parent: bool,
8078
) -> Result<(), insert_parents::Error> {
@@ -266,7 +264,7 @@ pub struct Commit<T> {
266264
/// The parents of the commit.
267265
pub parents: SmallVec<[gix_hash::ObjectId; 1]>,
268266
/// The time at which the commit was created.
269-
pub commit_time: CommitterTimestamp,
267+
pub commit_time: SecondsSinceUnixEpoch,
270268
/// The generation of the commit, if available.
271269
pub generation: Option<u32>,
272270
/// Any kind of data to associate with this commit.

0 commit comments

Comments
 (0)