History

[pack #179] refactor

Sebastian Thiel committed 5 years ago

Commit ab6554b1 parent 620d8a518 files · +74 −85Browse files

Showing the changes to git-diff (1 of 18 files). Show all

Unified · Split

git-diff/tests/visit/mod.rs+9−9
@@ -24,7 +24,7 @@ mod changes { · 23 unmodified lines
2424 buf: &'a mut Vec<u8>,
2525 ) -> crate::Result<TreeRefIter<'a>> {
2626 let tree_id = db
27− .find(commit, buf, &mut pack::cache::Never)?
27+ .try_find(commit, buf, &mut pack::cache::Never)?
2828 .ok_or_else(|| format!("start commit {:?} to be present", commit))?
2929 .decode()?
3030 .into_commit()
@@ -32,7 +32,7 @@ mod changes { · 1 unmodified line
3232 .tree();
3333
3434 Ok(db
35− .find(tree_id, buf, &mut pack::cache::Never)?
35+ .try_find(tree_id, buf, &mut pack::cache::Never)?
3636 .expect("main tree present")
3737 .into_tree_iter()
3838 .expect("id to be a tree"))
@@ -50,7 +50,7 @@ mod changes { · 11 unmodified lines
5050 rhs_tree,
5151 git_diff::tree::State::default(),
5252 |oid, buf| {
53− db.find(oid, buf, &mut pack::cache::Never)
53+ db.try_find(oid, buf, &mut pack::cache::Never)
5454 .ok()
5555 .flatten()
5656 .and_then(|obj| obj.into_tree_iter())
@@ -64,7 +64,7 @@ mod changes { · 7 unmodified lines
6464 let mut buf = Vec::new();
6565 let (main_tree_id, parent_commit_id) = {
6666 let commit = db
67− .find(commit_id, &mut buf, &mut pack::cache::Never)?
67+ .try_find(commit_id, &mut buf, &mut pack::cache::Never)?
6868 .ok_or_else(|| format!("start commit {:?} to be present", commit_id))?
6969 .decode()?
7070 .into_commit()
@@ -76,18 +76,18 @@ mod changes { · 5 unmodified lines
7676 })
7777 };
7878 let current_tree = db
79− .find(main_tree_id, &mut buf, &mut pack::cache::Never)?
79+ .try_find(main_tree_id, &mut buf, &mut pack::cache::Never)?
8080 .expect("main tree present")
8181 .into_tree_iter()
8282 .expect("id to be a tree");
8383 let mut buf2 = Vec::new();
8484 let previous_tree: Option<_> = {
8585 parent_commit_id
86− .and_then(|id| db.find(id, &mut buf2, &mut pack::cache::Never).ok().flatten())
86+ .and_then(|id| db.try_find(id, &mut buf2, &mut pack::cache::Never).ok().flatten())
8787 .and_then(|c| c.decode().ok())
8888 .and_then(|c| c.into_commit())
8989 .map(|c| c.tree())
90− .and_then(|tree| db.find(tree, &mut buf2, &mut pack::cache::Never).ok().flatten())
90+ .and_then(|tree| db.try_find(tree, &mut buf2, &mut pack::cache::Never).ok().flatten())
9191 .and_then(|tree| tree.into_tree_iter())
9292 };
9393
@@ -96,7 +96,7 @@ mod changes { · 2 unmodified lines
9696 current_tree,
9797 &mut git_diff::tree::State::default(),
9898 |oid, buf| {
99− db.find(oid, buf, &mut pack::cache::Never)
99+ db.try_find(oid, buf, &mut pack::cache::Never)
100100 .ok()
101101 .flatten()
102102 .and_then(|obj| obj.into_tree_iter())
@@ -130,7 +130,7 @@ mod changes { · 27 unmodified lines
130130
131131 let head = head_of(db);
132132 commit::Ancestors::new(Some(head), commit::ancestors::State::default(), |oid, buf| {
133− db.find(oid, buf, &mut pack::cache::Never)
133+ db.try_find(oid, buf, &mut pack::cache::Never)
134134 .ok()
135135 .flatten()
136136 .and_then(|o| o.into_commit_iter())