Showing the changes to git-diff (1 of 18 files). Show all
Unified · Split
| @@ -24,7 +24,7 @@ mod changes { · 23 unmodified lines | |||
| 24 | buf: &'a mut Vec<u8>, | 24 | buf: &'a mut Vec<u8>, |
| 25 | ) -> crate::Result<TreeRefIter<'a>> { | 25 | ) -> crate::Result<TreeRefIter<'a>> { |
| 26 | let tree_id = db | 26 | let tree_id = db |
| 27 | .find(commit, buf, &mut pack::cache::Never)? | 27 | .try_find(commit, buf, &mut pack::cache::Never)? |
| 28 | .ok_or_else(|| format!("start commit {:?} to be present", commit))? | 28 | .ok_or_else(|| format!("start commit {:?} to be present", commit))? |
| 29 | .decode()? | 29 | .decode()? |
| 30 | .into_commit() | 30 | .into_commit() |
| @@ -32,7 +32,7 @@ mod changes { · 1 unmodified line | |||
| 32 | .tree(); | 32 | .tree(); |
| 33 | 33 | ||
| 34 | Ok(db | 34 | Ok(db |
| 35 | .find(tree_id, buf, &mut pack::cache::Never)? | 35 | .try_find(tree_id, buf, &mut pack::cache::Never)? |
| 36 | .expect("main tree present") | 36 | .expect("main tree present") |
| 37 | .into_tree_iter() | 37 | .into_tree_iter() |
| 38 | .expect("id to be a tree")) | 38 | .expect("id to be a tree")) |
| @@ -50,7 +50,7 @@ mod changes { · 11 unmodified lines | |||
| 50 | rhs_tree, | 50 | rhs_tree, |
| 51 | git_diff::tree::State::default(), | 51 | git_diff::tree::State::default(), |
| 52 | |oid, buf| { | 52 | |oid, buf| { |
| 53 | db.find(oid, buf, &mut pack::cache::Never) | 53 | db.try_find(oid, buf, &mut pack::cache::Never) |
| 54 | .ok() | 54 | .ok() |
| 55 | .flatten() | 55 | .flatten() |
| 56 | .and_then(|obj| obj.into_tree_iter()) | 56 | .and_then(|obj| obj.into_tree_iter()) |
| @@ -64,7 +64,7 @@ mod changes { · 7 unmodified lines | |||
| 64 | let mut buf = Vec::new(); | 64 | let mut buf = Vec::new(); |
| 65 | let (main_tree_id, parent_commit_id) = { | 65 | let (main_tree_id, parent_commit_id) = { |
| 66 | let commit = db | 66 | let commit = db |
| 67 | .find(commit_id, &mut buf, &mut pack::cache::Never)? | 67 | .try_find(commit_id, &mut buf, &mut pack::cache::Never)? |
| 68 | .ok_or_else(|| format!("start commit {:?} to be present", commit_id))? | 68 | .ok_or_else(|| format!("start commit {:?} to be present", commit_id))? |
| 69 | .decode()? | 69 | .decode()? |
| 70 | .into_commit() | 70 | .into_commit() |
| @@ -76,18 +76,18 @@ mod changes { · 5 unmodified lines | |||
| 76 | }) | 76 | }) |
| 77 | }; | 77 | }; |
| 78 | let current_tree = db | 78 | 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)? |
| 80 | .expect("main tree present") | 80 | .expect("main tree present") |
| 81 | .into_tree_iter() | 81 | .into_tree_iter() |
| 82 | .expect("id to be a tree"); | 82 | .expect("id to be a tree"); |
| 83 | let mut buf2 = Vec::new(); | 83 | let mut buf2 = Vec::new(); |
| 84 | let previous_tree: Option<_> = { | 84 | let previous_tree: Option<_> = { |
| 85 | parent_commit_id | 85 | 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()) |
| 87 | .and_then(|c| c.decode().ok()) | 87 | .and_then(|c| c.decode().ok()) |
| 88 | .and_then(|c| c.into_commit()) | 88 | .and_then(|c| c.into_commit()) |
| 89 | .map(|c| c.tree()) | 89 | .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()) |
| 91 | .and_then(|tree| tree.into_tree_iter()) | 91 | .and_then(|tree| tree.into_tree_iter()) |
| 92 | }; | 92 | }; |
| 93 | 93 | ||
| @@ -96,7 +96,7 @@ mod changes { · 2 unmodified lines | |||
| 96 | current_tree, | 96 | current_tree, |
| 97 | &mut git_diff::tree::State::default(), | 97 | &mut git_diff::tree::State::default(), |
| 98 | |oid, buf| { | 98 | |oid, buf| { |
| 99 | db.find(oid, buf, &mut pack::cache::Never) | 99 | db.try_find(oid, buf, &mut pack::cache::Never) |
| 100 | .ok() | 100 | .ok() |
| 101 | .flatten() | 101 | .flatten() |
| 102 | .and_then(|obj| obj.into_tree_iter()) | 102 | .and_then(|obj| obj.into_tree_iter()) |
| @@ -130,7 +130,7 @@ mod changes { · 27 unmodified lines | |||
| 130 | 130 | ||
| 131 | let head = head_of(db); | 131 | let head = head_of(db); |
| 132 | commit::Ancestors::new(Some(head), commit::ancestors::State::default(), |oid, buf| { | 132 | 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) |
| 134 | .ok() | 134 | .ok() |
| 135 | .flatten() | 135 | .flatten() |
| 136 | .and_then(|o| o.into_commit_iter()) | 136 | .and_then(|o| o.into_commit_iter()) |