This will break a lot, but has to happen to prepare these traits for the next generation of object databases.
Showing the changes to git-diff (1 of 49 files). Show all
Unified · Split
| @@ -3,7 +3,7 @@ mod changes { · 2 unmodified lines | ||
| 3 | 3 | use git_diff::tree::{recorder, recorder::Change::*}; |
| 4 | 4 | use git_hash::{oid, ObjectId}; |
| 5 | 5 | use git_object::{bstr::ByteSlice, tree::EntryMode, TreeRefIter}; |
| 6 | − use git_odb::{linked, pack, Find}; | |
| 6 | + use git_odb::{linked, pack, pack::Find}; | |
| 7 | 7 | |
| 8 | 8 | use crate::hex_to_id; |
| 9 | 9 | |
| @@ -26,6 +26,7 @@ mod changes { · 16 unmodified lines | ||
| 26 | 26 | let tree_id = db |
| 27 | 27 | .try_find(commit, buf, &mut pack::cache::Never)? |
| 28 | 28 | .ok_or_else(|| format!("start commit {:?} to be present", commit))? |
| 29 | + .0 | |
| 29 | 30 | .decode()? |
| 30 | 31 | .into_commit() |
| 31 | 32 | .expect("id is actually a commit") |
| @@ -34,6 +35,7 @@ mod changes { · 2 unmodified lines | ||
| 34 | 35 | Ok(db |
| 35 | 36 | .try_find(tree_id, buf, &mut pack::cache::Never)? |
| 36 | 37 | .expect("main tree present") |
| 38 | + .0 | |
| 37 | 39 | .try_into_tree_iter() |
| 38 | 40 | .expect("id to be a tree")) |
| 39 | 41 | } |
| @@ -53,7 +55,7 @@ mod changes { · 13 unmodified lines | ||
| 53 | 55 | db.try_find(oid, buf, &mut pack::cache::Never) |
| 54 | 56 | .ok() |
| 55 | 57 | .flatten() |
| 56 | − .and_then(|obj| obj.try_into_tree_iter()) | |
| 58 | + .and_then(|obj| obj.0.try_into_tree_iter()) | |
| 57 | 59 | }, |
| 58 | 60 | &mut recorder, |
| 59 | 61 | )?; |
| @@ -66,6 +68,7 @@ mod changes { · 6 unmodified lines | ||
| 66 | 68 | let commit = db |
| 67 | 69 | .try_find(commit_id, &mut buf, &mut pack::cache::Never)? |
| 68 | 70 | .ok_or_else(|| format!("start commit {:?} to be present", commit_id))? |
| 71 | + .0 | |
| 69 | 72 | .decode()? |
| 70 | 73 | .into_commit() |
| 71 | 74 | .expect("id is actually a commit"); |
| @@ -78,17 +81,18 @@ mod changes { · 6 unmodified lines | ||
| 78 | 81 | let current_tree = db |
| 79 | 82 | .try_find(main_tree_id, &mut buf, &mut pack::cache::Never)? |
| 80 | 83 | .expect("main tree present") |
| 84 | + .0 | |
| 81 | 85 | .try_into_tree_iter() |
| 82 | 86 | .expect("id to be a tree"); |
| 83 | 87 | let mut buf2 = Vec::new(); |
| 84 | 88 | let previous_tree: Option<_> = { |
| 85 | 89 | parent_commit_id |
| 86 | 90 | .and_then(|id| db.try_find(id, &mut buf2, &mut pack::cache::Never).ok().flatten()) |
| 87 | − .and_then(|c| c.decode().ok()) | |
| 91 | + .and_then(|(c, _l)| c.decode().ok()) | |
| 88 | 92 | .and_then(|c| c.into_commit()) |
| 89 | 93 | .map(|c| c.tree()) |
| 90 | 94 | .and_then(|tree| db.try_find(tree, &mut buf2, &mut pack::cache::Never).ok().flatten()) |
| 91 | − .and_then(|tree| tree.try_into_tree_iter()) | |
| 95 | + .and_then(|(tree, _)| tree.try_into_tree_iter()) | |
| 92 | 96 | }; |
| 93 | 97 | |
| 94 | 98 | let mut recorder = git_diff::tree::Recorder::default(); |
| @@ -99,7 +103,7 @@ mod changes { · 4 unmodified lines | ||
| 99 | 103 | db.try_find(oid, buf, &mut pack::cache::Never) |
| 100 | 104 | .ok() |
| 101 | 105 | .flatten() |
| 102 | − .and_then(|obj| obj.try_into_tree_iter()) | |
| 106 | + .and_then(|(obj, _)| obj.try_into_tree_iter()) | |
| 103 | 107 | }, |
| 104 | 108 | &mut recorder, |
| 105 | 109 | )?; |
| @@ -133,7 +137,7 @@ mod changes { · 27 unmodified lines | ||
| 133 | 137 | db.try_find(oid, buf, &mut pack::cache::Never) |
| 134 | 138 | .ok() |
| 135 | 139 | .flatten() |
| 136 | − .and_then(|o| o.try_into_commit_iter()) | |
| 140 | + .and_then(|t| t.0.try_into_commit_iter()) | |
| 137 | 141 | }) |
| 138 | 142 | .collect::<Vec<_>>() |
| 139 | 143 | .into_iter() |