| @@ -1,6 +1,10 @@ |
| 1 | use crate::visit; | 1 | use crate::{ |
| 2 | use crate::visit::changes::Error::Cancelled; | 2 | visit, |
| 3 | use crate::visit::record::{Action, Change, PathComponent, PathComponentUpdateMode}; | 3 | visit::{ |
| | 4 | changes::Error::Cancelled, |
| | 5 | record::{Action, Change, PathComponent, PathComponentUpdateMode}, |
| | 6 | }, |
| | 7 | }; |
| 4 | use git_hash::{oid, ObjectId}; | 8 | use git_hash::{oid, ObjectId}; |
| 5 | use git_object::{immutable, tree}; | 9 | use git_object::{immutable, tree}; |
| 6 | use quick_error::quick_error; | 10 | use quick_error::quick_error; |
| @@ -22,10 +26,7 @@ quick_error! { · 15 unmodified lines |
| 22 | } | 26 | } |
| 23 | } | 27 | } |
| 24 | | 28 | |
| 25 | impl<'a, Iter> visit::Changes<'a, Iter> | 29 | impl<'a> visit::Changes<'a> { |
| 26 | where | | |
| 27 | Iter: Iterator<Item = super::TreeEntryResult<'a>>, | | |
| 28 | { | | |
| 29 | /// Returns the changes that need to be applied to `self` to get `other`. | 30 | /// Returns the changes that need to be applied to `self` to get `other`. |
| 30 | /// | 31 | /// |
| 31 | /// # Notes | 32 | /// # Notes |
| @@ -36,8 +37,8 @@ where · 4 unmodified lines |
| 36 | /// [git_cmp_rs]: https://github.com/Byron/gitoxide/blob/a4d5f99c8dc99bf814790928a3bf9649cd99486b/git-object/src/mutable/tree.rs#L52-L55 | 37 | /// [git_cmp_rs]: https://github.com/Byron/gitoxide/blob/a4d5f99c8dc99bf814790928a3bf9649cd99486b/git-object/src/mutable/tree.rs#L52-L55 |
| 37 | /// | 38 | /// |
| 38 | pub fn needed_to_obtain<LocateFn>( | 39 | pub fn needed_to_obtain<LocateFn>( |
| 39 | self, | 40 | mut self, |
| 40 | other: Iter, | 41 | other: immutable::TreeIter<'a>, |
| 41 | _state: &mut visit::State, | 42 | _state: &mut visit::State, |
| 42 | _locate: LocateFn, | 43 | _locate: LocateFn, |
| 43 | delegate: &mut impl visit::Record, | 44 | delegate: &mut impl visit::Record, |
| @@ -45,7 +46,7 @@ where · 1 unmodified line |
| 45 | where | 46 | where |
| 46 | LocateFn: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Option<immutable::Object<'b>>, | 47 | LocateFn: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Option<immutable::Object<'b>>, |
| 47 | { | 48 | { |
| 48 | let mut lhs_entries = self.0; | 49 | let mut lhs_entries = self.0.take().unwrap_or_default(); |
| 49 | let mut rhs_entries = other; | 50 | let mut rhs_entries = other; |
| 50 | | 51 | |
| 51 | let mut path_id = 0; | 52 | let mut path_id = 0; |