History

[tempfile] interruptible traversal

Sebastian Thiel committed 5 years ago

Commit 4eeaa1b1 parent 1825e1a1 file · +13 −10Browse files

Unified · Split

gitoxide-core/src/pack/create.rs+13−10
@@ -103,17 +103,20 @@ where · 102 unmodified lines
103 None => Box::new({103 None => Box::new({
104 let mut progress = progress.add_child("traversing");104 let mut progress = progress.add_child("traversing");
105 progress.init(None, progress::count("commits"));105 progress.init(None, progress::count("commits"));
106 traverse::commit::Ancestors::new(106 interrupt::Iter::new(
107 tips.map(|t| ObjectId::from_hex(&Vec::from_os_str_lossy(t.as_ref())))107 traverse::commit::Ancestors::new(
108 .collect::<Result<Vec<_>, _>>()?,108 tips.map(|t| ObjectId::from_hex(&Vec::from_os_str_lossy(t.as_ref())))
109 traverse::commit::ancestors::State::default(),109 .collect::<Result<Vec<_>, _>>()?,
110 {110 traverse::commit::ancestors::State::default(),
111 let db = Arc::clone(&db);111 {
112 move |oid, buf| db.find_existing_commit_iter(oid, buf, &mut pack::cache::Never).ok()112 let db = Arc::clone(&db);
113 },113 move |oid, buf| db.find_existing_commit_iter(oid, buf, &mut pack::cache::Never).ok()
114 },
115 )
116 .inspect(move |_| progress.inc()),
117 make_cancellation_err,
114 )118 )
115 .inspect(move |_| progress.inc())119 .collect::<Result<Result<Vec<_>, _>, _>>()??
116 .collect::<Result<Vec<_>, _>>()?
117 .into_iter()120 .into_iter()
118 }),121 }),
119 Some(input) => Box::new(input.lines().filter_map(|hex_id| {122 Some(input) => Box::new(input.lines().filter_map(|hex_id| {