Showing the changes to git-diff (3 of 3 files). Show all
Unified · Split
| @@ -130,9 +130,11 @@ impl<'a> visit::Changes<'a> { · 129 unmodified lines | ||
| 130 | 130 | Greater => { |
| 131 | 131 | add_entry_schedule_recursion(rhs, &mut state.trees, delegate)?; |
| 132 | 132 | '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"); | |
| 136 | 138 | handle_lhs_and_rhs_with_equal_filenames( |
| 137 | 139 | lhs, |
| 138 | 140 | rhs, |
| @@ -140,11 +142,20 @@ impl<'a> visit::Changes<'a> { · 1 unmodified line | ||
| 140 | 142 | delegate, |
| 141 | 143 | )?; |
| 142 | 144 | break 'inner_greater; |
| 143 | − } else { | |
| 145 | + } | |
| 146 | + Greater => { | |
| 147 | + let rhs = | |
| 148 | + rhs_entries.next().transpose()?.expect("the peeked item tobe present"); | |
| 144 | 149 | delegate.pop_path_component(); |
| 145 | 150 | add_entry_schedule_recursion(rhs, &mut state.trees, delegate)?; |
| 146 | 151 | } |
| 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())), | |
| 148 | 159 | None => { |
| 149 | 160 | todo!("GREATER: catchup less: break inner depleted - it never caught up"); |
| 150 | 161 | // break 'inner; |
| @@ -79,3 +79,8 @@ touch g/aa · 78 unmodified lines | ||
| 79 | 79 | git rm g/a |
| 80 | 80 | git add g/aa |
| 81 | 81 | git commit -qam 'rm g/a, add g/aa' |
| 82 | + | |
| 83 | +git rm ff | |
| 84 | +touch f | |
| 85 | +git add f | |
| 86 | +git commit -qam 'rm /ff, add /f' | |
| @@ -340,6 +340,23 @@ mod changes { · 339 unmodified lines | ||
| 340 | 340 | ":100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D g/a |
| 341 | 341 | :000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A g/aa" |
| 342 | 342 | ); |
| 343 | + assert_eq!( | |
| 344 | + diff_with_previous_commit_from(&db, &all_commits[18])?, | |
| 345 | + vec![ | |
| 346 | + recorder::Change::Addition { | |
| 347 | + entry_mode: EntryMode::Blob, | |
| 348 | + oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | |
| 349 | + path: "f".into() | |
| 350 | + }, | |
| 351 | + recorder::Change::Deletion { | |
| 352 | + entry_mode: EntryMode::Blob, | |
| 353 | + oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | |
| 354 | + path: "ff".into() | |
| 355 | + }, | |
| 356 | + ], | |
| 357 | + ":100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D f | |
| 358 | + :000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A ff" | |
| 359 | + ); | |
| 343 | 360 | Ok(()) |
| 344 | 361 | } |
| 345 | 362 | } |