+3
-5
lib/src/default_index/store.rs
+3
-5
lib/src/default_index/store.rs
···
16
16
17
17
use std::any::Any;
18
18
use std::collections::HashMap;
19
-
use std::collections::HashSet;
20
19
use std::fs;
21
20
use std::io;
22
21
use std::io::Write as _;
···
192
191
let operations_dir = self.operations_dir();
193
192
let commit_id_length = store.commit_id_length();
194
193
let change_id_length = store.change_id_length();
195
-
let mut visited_heads: HashSet<CommitId> = HashSet::new();
196
-
let mut historical_heads: Vec<(CommitId, OperationId)> = Vec::new();
197
194
let ops_to_visit: Vec<_> =
198
195
op_walk::walk_ancestors(slice::from_ref(operation)).try_collect()?;
199
196
// Pick the latest existing ancestor operation as the parent segment.
···
225
222
ops_count = ops_to_visit.len(),
226
223
"collecting head commits to index"
227
224
);
225
+
let mut historical_heads: HashMap<CommitId, OperationId> = HashMap::new();
228
226
for op in &ops_to_visit {
229
227
for commit_id in op.view()?.all_referenced_commit_ids() {
230
-
if visited_heads.insert(commit_id.clone()) {
231
-
historical_heads.push((commit_id.clone(), op.id().clone()));
228
+
if !historical_heads.contains_key(commit_id) {
229
+
historical_heads.insert(commit_id.clone(), op.id().clone());
232
230
}
233
231
}
234
232
}