History

[tree-diff] another green test

Sebastian Thiel committed 5 years ago

Commit 2627df01 parent 05e8e4a3 files · +38 −5Browse files

Showing the changes to git-diff/src (1 of 3 files). Show all

Unified · Split

git-diff/src/visit/changes.rs+16−5
@@ -130,9 +130,11 @@ impl<'a> visit::Changes<'a> { · 129 unmodified lines
130130 Greater => {
131131 add_entry_schedule_recursion(rhs, &mut state.trees, delegate)?;
132132 'inner_greater: loop {
133− match rhs_entries.next().transpose()? {
134− Some(rhs) => {
135− if lhs.filename == rhs.filename {
133+ match rhs_entries.peek() {
134+ Some(Ok(rhs)) => match lhs.filename.cmp(rhs.filename) {
135+ Equal => {
136+ let rhs =
137+ rhs_entries.next().transpose()?.expect("the peeked item tobe present");
136138 handle_lhs_and_rhs_with_equal_filenames(
137139 lhs,
138140 rhs,
@@ -140,11 +142,20 @@ impl<'a> visit::Changes<'a> { · 1 unmodified line
140142 delegate,
141143 )?;
142144 break 'inner_greater;
143− } else {
145+ }
146+ Greater => {
147+ let rhs =
148+ rhs_entries.next().transpose()?.expect("the peeked item tobe present");
144149 delegate.pop_path_component();
145150 add_entry_schedule_recursion(rhs, &mut state.trees, delegate)?;
146151 }
147− }
152+ Less => {
153+ delegate.pop_path_component();
154+ delete_entry_schedule_recursion(lhs, &mut state.trees, delegate)?;
155+ break 'inner_greater;
156+ }
157+ },
158+ Some(Err(err)) => return Err(Error::EntriesDecode(err.to_owned())),
148159 None => {
149160 todo!("GREATER: catchup less: break inner depleted - it never caught up");
150161 // break 'inner;