diff --git a/examples/log.rs b/examples/log.rs index be892f37e15..c143f8544cc 100644 --- a/examples/log.rs +++ b/examples/log.rs @@ -8,7 +8,7 @@ use clap::Parser; use gix::{ bstr::{BString, ByteSlice}, date::time::format, - traverse::commit::Sorting, + traverse::commit::simple::Sorting, }; fn main() { diff --git a/gitoxide-core/src/repository/commitgraph/list.rs b/gitoxide-core/src/repository/commitgraph/list.rs index 59e74a699cd..d9c024ed3f1 100644 --- a/gitoxide-core/src/repository/commitgraph/list.rs +++ b/gitoxide-core/src/repository/commitgraph/list.rs @@ -2,7 +2,7 @@ pub(crate) mod function { use std::{borrow::Cow, ffi::OsString}; use anyhow::{bail, Context}; - use gix::{prelude::ObjectIdExt, traverse::commit::Sorting}; + use gix::{prelude::ObjectIdExt, traverse::commit::simple::Sorting}; use crate::OutputFormat; diff --git a/gitoxide-core/src/repository/revision/list.rs b/gitoxide-core/src/repository/revision/list.rs index ab2bb2a60ed..7050bb6a667 100644 --- a/gitoxide-core/src/repository/revision/list.rs +++ b/gitoxide-core/src/repository/revision/list.rs @@ -17,7 +17,7 @@ pub const PROGRESS_RANGE: std::ops::RangeInclusive = 0..=2; pub(crate) mod function { use anyhow::{bail, Context}; - use gix::{hashtable::HashMap, traverse::commit::Sorting, Progress}; + use gix::{hashtable::HashMap, traverse::commit::simple::Sorting, Progress}; use layout::{ backends::svg::SVGWriter, core::{base::Orientation, geometry::Point, style::StyleAttr}, diff --git a/gix-diff/tests/tree/mod.rs b/gix-diff/tests/tree/mod.rs index bd57c5fc8dd..85fcbe6170c 100644 --- a/gix-diff/tests/tree/mod.rs +++ b/gix-diff/tests/tree/mod.rs @@ -129,11 +129,10 @@ mod changes { } fn all_commits(db: &gix_odb::Handle) -> HashMap { - use gix_traverse::commit; let mut buf = Vec::new(); let head = head_of(db); - commit::Simple::new(Some(head), &db) + gix_traverse::commit::Simple::new(Some(head), &db) .collect::, _>>() .expect("valid iteration") .into_iter() diff --git a/gix-pack/tests/pack/data/output/count_and_entries.rs b/gix-pack/tests/pack/data/output/count_and_entries.rs index f357f894798..c20bdf52727 100644 --- a/gix-pack/tests/pack/data/output/count_and_entries.rs +++ b/gix-pack/tests/pack/data/output/count_and_entries.rs @@ -9,7 +9,6 @@ use gix_pack::data::{ output, output::{count, entry}, }; -use gix_traverse::commit; use crate::pack::{ data::output::{db, DbKind}, @@ -241,7 +240,7 @@ fn traversals() -> crate::Result { .copied() { let head = hex_to_id("dfcb5e39ac6eb30179808bbab721e8a28ce1b52e"); - let mut commits = commit::Simple::new(Some(head), db.clone()) + let mut commits = gix_traverse::commit::Simple::new(Some(head), db.clone()) .map(Result::unwrap) .map(|c| c.id) .collect::>(); diff --git a/gix/src/ext/object_id.rs b/gix/src/ext/object_id.rs index 44e03bbd7c9..d7f91164170 100644 --- a/gix/src/ext/object_id.rs +++ b/gix/src/ext/object_id.rs @@ -1,9 +1,8 @@ use gix_hash::ObjectId; -use gix_traverse::commit::Simple; pub trait Sealed {} -pub type AncestorsIter = Simple bool>; +pub type AncestorsIter = gix_traverse::commit::Simple bool>; /// An extension trait to add functionality to [`ObjectId`]s. pub trait ObjectIdExt: Sealed { @@ -23,7 +22,7 @@ impl ObjectIdExt for ObjectId { where Find: gix_object::Find, { - Simple::new(Some(self), find) + gix_traverse::commit::Simple::new(Some(self), find) } fn attach(self, repo: &crate::Repository) -> crate::Id<'_> { diff --git a/gix/src/remote/connection/fetch/update_refs/mod.rs b/gix/src/remote/connection/fetch/update_refs/mod.rs index 06a74fb3cbc..e5d3eac1b2d 100644 --- a/gix/src/remote/connection/fetch/update_refs/mod.rs +++ b/gix/src/remote/connection/fetch/update_refs/mod.rs @@ -162,7 +162,7 @@ pub(crate) fn update( .to_owned() .ancestors(&repo.objects) .sorting( - gix_traverse::commit::Sorting::ByCommitTimeNewestFirstCutoffOlderThan { + gix_traverse::commit::simple::Sorting::ByCommitTimeNewestFirstCutoffOlderThan { seconds: local_commit_time }, ) diff --git a/gix/src/revision/spec/parse/delegate/navigate.rs b/gix/src/revision/spec/parse/delegate/navigate.rs index acd8ecc530b..43f40654f40 100644 --- a/gix/src/revision/spec/parse/delegate/navigate.rs +++ b/gix/src/revision/spec/parse/delegate/navigate.rs @@ -6,7 +6,6 @@ use gix_revision::spec::parse::{ delegate, delegate::{PeelTo, Traversal}, }; -use gix_traverse::commit::Sorting; use crate::{ bstr::{BStr, ByteSlice}, @@ -193,7 +192,7 @@ impl<'repo> delegate::Navigate for Delegate<'repo> { match oid .attach(repo) .ancestors() - .sorting(Sorting::ByCommitTimeNewestFirst) + .sorting(gix_traverse::commit::simple::Sorting::ByCommitTimeNewestFirst) .all() { Ok(iter) => { @@ -242,15 +241,10 @@ impl<'repo> delegate::Navigate for Delegate<'repo> { references .peeled() .filter_map(Result::ok) - .filter(|r| { - r.id() - .object() - .ok() - .map_or(false, |obj| obj.kind == gix_object::Kind::Commit) - }) + .filter(|r| r.id().header().ok().map_or(false, |obj| obj.kind().is_commit())) .filter_map(|r| r.detach().peeled), ) - .sorting(Sorting::ByCommitTimeNewestFirst) + .sorting(gix_traverse::commit::simple::Sorting::ByCommitTimeNewestFirst) .all() { Ok(iter) => { diff --git a/gix/src/revision/walk.rs b/gix/src/revision/walk.rs index 78e7c5c7497..dd7c5a8c1dc 100644 --- a/gix/src/revision/walk.rs +++ b/gix/src/revision/walk.rs @@ -8,7 +8,7 @@ use crate::{ext::ObjectIdExt, revision, Repository}; #[allow(missing_docs)] pub enum Error { #[error(transparent)] - AncestorIter(#[from] gix_traverse::commit::simple::Error), + SimpleTraversal(#[from] gix_traverse::commit::simple::Error), #[error(transparent)] ShallowCommits(#[from] crate::shallow::open::Error), #[error(transparent)] @@ -22,8 +22,8 @@ pub struct Info<'repo> { pub id: gix_hash::ObjectId, /// All parent ids we have encountered. Note that these will be at most one if [`Parents::First`][gix_traverse::commit::Parents::First] is enabled. pub parent_ids: gix_traverse::commit::ParentIds, - /// The time at which the commit was created. It's only `Some(_)` if sorting is not [`Sorting::BreadthFirst`][gix_traverse::commit::Sorting::BreadthFirst], - /// as the walk needs to require the commit-date. + /// The time at which the commit was created. It will only be `Some(_)` if the chosen traversal was + /// taking dates into consideration. pub commit_time: Option, repo: &'repo Repository, @@ -91,7 +91,7 @@ impl<'repo> Info<'repo> { pub struct Platform<'repo> { pub(crate) repo: &'repo Repository, pub(crate) tips: Vec, - pub(crate) sorting: gix_traverse::commit::Sorting, + pub(crate) sorting: gix_traverse::commit::simple::Sorting, pub(crate) parents: gix_traverse::commit::Parents, pub(crate) use_commit_graph: Option, pub(crate) commit_graph: Option, @@ -113,7 +113,7 @@ impl<'repo> Platform<'repo> { /// Create-time builder methods impl<'repo> Platform<'repo> { /// Set the sort mode for commits to the given value. The default is to order topologically breadth-first. - pub fn sorting(mut self, sorting: gix_traverse::commit::Sorting) -> Self { + pub fn sorting(mut self, sorting: gix_traverse::commit::simple::Sorting) -> Self { self.sorting = sorting; self } diff --git a/gix/tests/id/mod.rs b/gix/tests/id/mod.rs index f284a76e65a..143881d92c9 100644 --- a/gix/tests/id/mod.rs +++ b/gix/tests/id/mod.rs @@ -87,7 +87,7 @@ mod ancestors { let commits_by_commit_date = head .ancestors() .use_commit_graph(!use_commit_graph) - .sorting(commit::Sorting::ByCommitTimeNewestFirst) + .sorting(commit::simple::Sorting::ByCommitTimeNewestFirst) .all()? .map(|c| c.map(gix::revision::walk::Info::detach)) .collect::, _>>()?; @@ -121,7 +121,7 @@ mod ancestors { let head = repo.head()?.into_peeled_id()?; let commits = head .ancestors() - .sorting(commit::Sorting::ByCommitTimeNewestFirst) // assure we have time set + .sorting(commit::simple::Sorting::ByCommitTimeNewestFirst) // assure we have time set .use_commit_graph(use_commit_graph) .all()? .collect::, _>>()?; @@ -141,9 +141,9 @@ mod ancestors { for use_commit_graph in [false, true] { for sorting in [ - commit::Sorting::BreadthFirst, - commit::Sorting::ByCommitTimeNewestFirst, - commit::Sorting::ByCommitTimeNewestFirstCutoffOlderThan { seconds: 0 }, + commit::simple::Sorting::BreadthFirst, + commit::simple::Sorting::ByCommitTimeNewestFirst, + commit::simple::Sorting::ByCommitTimeNewestFirstCutoffOlderThan { seconds: 0 }, ] { let commits_graph_order = head .ancestors() diff --git a/gix/tests/repository/shallow.rs b/gix/tests/repository/shallow.rs index aac1ee5cc37..8e5c2bd0a66 100644 --- a/gix/tests/repository/shallow.rs +++ b/gix/tests/repository/shallow.rs @@ -44,7 +44,7 @@ fn yes() -> crate::Result { } mod traverse { - use gix_traverse::commit::Sorting; + use gix_traverse::commit::simple::Sorting; use serial_test::parallel; use crate::util::{hex_to_id, named_subrepo_opts};