+4
-8
lib/src/default_index/store.rs
+4
-8
lib/src/default_index/store.rs
···
21
21
use std::io::Write as _;
22
22
use std::path::Path;
23
23
use std::path::PathBuf;
24
+
use std::slice;
24
25
use std::sync::Arc;
25
26
26
27
use itertools::Itertools as _;
···
49
50
use crate::object_id::ObjectId as _;
50
51
use crate::op_store::OpStoreError;
51
52
use crate::op_store::OperationId;
53
+
use crate::op_walk;
52
54
use crate::operation::Operation;
53
55
use crate::store::Store;
54
56
···
192
194
let mut visited_heads: HashSet<CommitId> = HashSet::new();
193
195
let mut historical_heads: Vec<(CommitId, OperationId)> = Vec::new();
194
196
let mut parent_op_id: Option<OperationId> = None;
195
-
for op in dag_walk::dfs_ok(
196
-
[Ok(operation.clone())],
197
-
|op: &Operation| op.id().clone(),
198
-
|op: &Operation| op.parents().collect_vec(),
199
-
) {
197
+
for op in op_walk::walk_ancestors(slice::from_ref(operation)) {
200
198
let op = op?;
201
199
// Pick the latest existing ancestor operation as the parent
202
-
// segment. Perhaps, breadth-first search is more appropriate here,
203
-
// but that wouldn't matter in practice as the operation log is
204
-
// mostly linear.
200
+
// segment.
205
201
if parent_op_id.is_none() && operations_dir.join(op.id().hex()).is_file() {
206
202
parent_op_id = Some(op.id().clone());
207
203
}