Skip to content

Commit 6154bf3

Browse files
committed
adapt to changes in gix-traverse
1 parent e0969c3 commit 6154bf3

File tree

5 files changed

+33
-38
lines changed

5 files changed

+33
-38
lines changed

gitoxide-core/src/pack/create.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ where
130130
.collect::<Result<Vec<_>, _>>()?;
131131
let handle = repo.objects.into_shared_arc().to_cache_arc();
132132
let iter = Box::new(
133-
traverse::commit::Ancestors::new(tips, traverse::commit::ancestors::State::default(), handle.clone())
133+
traverse::commit::Ancestors::new(tips, handle.clone())
134134
.map(|res| res.map_err(|err| Box::new(err) as Box<_>).map(|c| c.id))
135135
.inspect(move |_| progress.inc()),
136136
);

gix-diff/tests/tree/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ mod changes {
133133
let mut buf = Vec::new();
134134

135135
let head = head_of(db);
136-
commit::Ancestors::new(Some(head), commit::ancestors::State::default(), &db)
136+
commit::Ancestors::new(Some(head), &db)
137137
.collect::<Result<Vec<_>, _>>()
138138
.expect("valid iteration")
139139
.into_iter()

gix-pack/tests/pack/data/output/count_and_entries.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ fn traversals() -> crate::Result {
241241
.copied()
242242
{
243243
let head = hex_to_id("dfcb5e39ac6eb30179808bbab721e8a28ce1b52e");
244-
let mut commits = commit::Ancestors::new(Some(head), commit::ancestors::State::default(), db.clone())
244+
let mut commits = commit::Ancestors::new(Some(head), db.clone())
245245
.map(Result::unwrap)
246246
.map(|c| c.id)
247247
.collect::<Vec<_>>();

gix/src/ext/object_id.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use gix_hash::ObjectId;
2-
use gix_traverse::commit::{ancestors, Ancestors};
2+
use gix_traverse::commit::Ancestors;
33

44
pub trait Sealed {}
55

6-
pub type AncestorsIter<Find> = Ancestors<Find, fn(&gix_hash::oid) -> bool, ancestors::State>;
6+
pub type AncestorsIter<Find> = Ancestors<Find, fn(&gix_hash::oid) -> bool>;
77

88
/// An extension trait to add functionality to [`ObjectId`]s.
99
pub trait ObjectIdExt: Sealed {
@@ -23,7 +23,7 @@ impl ObjectIdExt for ObjectId {
2323
where
2424
Find: gix_object::Find,
2525
{
26-
Ancestors::new(Some(self), ancestors::State::default(), find)
26+
Ancestors::new(Some(self), find)
2727
}
2828

2929
fn attach(self, repo: &crate::Repository) -> crate::Id<'_> {

gix/src/revision/walk.rs

+27-32
Original file line numberDiff line numberDiff line change
@@ -166,40 +166,35 @@ impl<'repo> Platform<'repo> {
166166
Ok(revision::Walk {
167167
repo,
168168
inner: Box::new(
169-
gix_traverse::commit::Ancestors::filtered(
170-
tips,
171-
gix_traverse::commit::ancestors::State::default(),
172-
&repo.objects,
173-
{
174-
// Note that specific shallow handling for commit-graphs isn't needed as these contain
175-
// all information there is, and exclude shallow parents to be structurally consistent.
176-
let shallow_commits = repo.shallow_commits()?;
177-
let mut grafted_parents_to_skip = Vec::new();
178-
let mut buf = Vec::new();
179-
move |id| {
180-
if !filter(id) {
181-
return false;
182-
}
183-
match shallow_commits.as_ref() {
184-
Some(commits) => {
185-
let id = id.to_owned();
186-
if let Ok(idx) = grafted_parents_to_skip.binary_search(&id) {
187-
grafted_parents_to_skip.remove(idx);
188-
return false;
189-
};
190-
if commits.binary_search(&id).is_ok() {
191-
if let Ok(commit) = repo.objects.find_commit_iter(&id, &mut buf) {
192-
grafted_parents_to_skip.extend(commit.parent_ids());
193-
grafted_parents_to_skip.sort();
194-
}
195-
};
196-
true
197-
}
198-
None => true,
169+
gix_traverse::commit::Ancestors::filtered(tips, &repo.objects, {
170+
// Note that specific shallow handling for commit-graphs isn't needed as these contain
171+
// all information there is, and exclude shallow parents to be structurally consistent.
172+
let shallow_commits = repo.shallow_commits()?;
173+
let mut grafted_parents_to_skip = Vec::new();
174+
let mut buf = Vec::new();
175+
move |id| {
176+
if !filter(id) {
177+
return false;
178+
}
179+
match shallow_commits.as_ref() {
180+
Some(commits) => {
181+
let id = id.to_owned();
182+
if let Ok(idx) = grafted_parents_to_skip.binary_search(&id) {
183+
grafted_parents_to_skip.remove(idx);
184+
return false;
185+
};
186+
if commits.binary_search(&id).is_ok() {
187+
if let Ok(commit) = repo.objects.find_commit_iter(&id, &mut buf) {
188+
grafted_parents_to_skip.extend(commit.parent_ids());
189+
grafted_parents_to_skip.sort();
190+
}
191+
};
192+
true
199193
}
194+
None => true,
200195
}
201-
},
202-
)
196+
}
197+
})
203198
.sorting(sorting)?
204199
.parents(parents)
205200
.commit_graph(

0 commit comments

Comments
 (0)