diff --git a/gitoxide-core/src/pack/create.rs b/gitoxide-core/src/pack/create.rs index f8141e357d..1229ddd276 100644 --- a/gitoxide-core/src/pack/create.rs +++ b/gitoxide-core/src/pack/create.rs @@ -130,7 +130,7 @@ where .collect::, _>>()?; let handle = repo.objects.into_shared_arc().to_cache_arc(); let iter = Box::new( - traverse::commit::Ancestors::new(tips, traverse::commit::ancestors::State::default(), handle.clone()) + traverse::commit::Ancestors::new(tips, handle.clone()) .map(|res| res.map_err(|err| Box::new(err) as Box<_>).map(|c| c.id)) .inspect(move |_| progress.inc()), ); diff --git a/gix-diff/tests/tree/mod.rs b/gix-diff/tests/tree/mod.rs index 7df8f64c7c..ace13c36c9 100644 --- a/gix-diff/tests/tree/mod.rs +++ b/gix-diff/tests/tree/mod.rs @@ -133,7 +133,7 @@ mod changes { let mut buf = Vec::new(); let head = head_of(db); - commit::Ancestors::new(Some(head), commit::ancestors::State::default(), &db) + commit::Ancestors::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 a98f02d387..c5e7b960d9 100644 --- a/gix-pack/tests/pack/data/output/count_and_entries.rs +++ b/gix-pack/tests/pack/data/output/count_and_entries.rs @@ -241,7 +241,7 @@ fn traversals() -> crate::Result { .copied() { let head = hex_to_id("dfcb5e39ac6eb30179808bbab721e8a28ce1b52e"); - let mut commits = commit::Ancestors::new(Some(head), commit::ancestors::State::default(), db.clone()) + let mut commits = commit::Ancestors::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 d4d9467664..018c0ab032 100644 --- a/gix/src/ext/object_id.rs +++ b/gix/src/ext/object_id.rs @@ -1,9 +1,9 @@ use gix_hash::ObjectId; -use gix_traverse::commit::{ancestors, Ancestors}; +use gix_traverse::commit::Ancestors; pub trait Sealed {} -pub type AncestorsIter = Ancestors bool, ancestors::State>; +pub type AncestorsIter = Ancestors bool>; /// An extension trait to add functionality to [`ObjectId`]s. pub trait ObjectIdExt: Sealed { @@ -23,7 +23,7 @@ impl ObjectIdExt for ObjectId { where Find: gix_object::Find, { - Ancestors::new(Some(self), ancestors::State::default(), find) + Ancestors::new(Some(self), find) } fn attach(self, repo: &crate::Repository) -> crate::Id<'_> { diff --git a/gix/src/revision/walk.rs b/gix/src/revision/walk.rs index 19d15d569a..a089733a47 100644 --- a/gix/src/revision/walk.rs +++ b/gix/src/revision/walk.rs @@ -166,40 +166,35 @@ impl<'repo> Platform<'repo> { Ok(revision::Walk { repo, inner: Box::new( - gix_traverse::commit::Ancestors::filtered( - tips, - gix_traverse::commit::ancestors::State::default(), - &repo.objects, - { - // Note that specific shallow handling for commit-graphs isn't needed as these contain - // all information there is, and exclude shallow parents to be structurally consistent. - let shallow_commits = repo.shallow_commits()?; - let mut grafted_parents_to_skip = Vec::new(); - let mut buf = Vec::new(); - move |id| { - if !filter(id) { - return false; - } - match shallow_commits.as_ref() { - Some(commits) => { - let id = id.to_owned(); - if let Ok(idx) = grafted_parents_to_skip.binary_search(&id) { - grafted_parents_to_skip.remove(idx); - return false; - }; - if commits.binary_search(&id).is_ok() { - if let Ok(commit) = repo.objects.find_commit_iter(&id, &mut buf) { - grafted_parents_to_skip.extend(commit.parent_ids()); - grafted_parents_to_skip.sort(); - } - }; - true - } - None => true, + gix_traverse::commit::Ancestors::filtered(tips, &repo.objects, { + // Note that specific shallow handling for commit-graphs isn't needed as these contain + // all information there is, and exclude shallow parents to be structurally consistent. + let shallow_commits = repo.shallow_commits()?; + let mut grafted_parents_to_skip = Vec::new(); + let mut buf = Vec::new(); + move |id| { + if !filter(id) { + return false; + } + match shallow_commits.as_ref() { + Some(commits) => { + let id = id.to_owned(); + if let Ok(idx) = grafted_parents_to_skip.binary_search(&id) { + grafted_parents_to_skip.remove(idx); + return false; + }; + if commits.binary_search(&id).is_ok() { + if let Ok(commit) = repo.objects.find_commit_iter(&id, &mut buf) { + grafted_parents_to_skip.extend(commit.parent_ids()); + grafted_parents_to_skip.sort(); + } + }; + true } + None => true, } - }, - ) + } + }) .sorting(sorting)? .parents(parents) .commit_graph(