History

[tree-diff] And another test that showed something was indeed wrong

Sebastian Thiel committed 5 years ago

Commit 362680f1 parent 85c57813 files · +100 −6Browse files

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

Unified · Split

2 files
  1. git-diff/src/visit/changes.rs +2 −0
  2. git-diff/src/visit/mod.rs +6 −3
git-diff/src/visit/changes.rs+2−0
@@ -178,6 +178,7 @@ fn catchup_rhs_with_lhs<R: visit::Record>( · 177 unmodified lines
178178 Some(Ok(rhs)) => match lhs.filename.cmp(rhs.filename) {
179179 Equal => {
180180 let rhs = rhs_entries.next().transpose()?.expect("the peeked item tobe present");
181+ delegate.pop_path_component();
181182 handle_lhs_and_rhs_with_equal_filenames(lhs, rhs, queue, delegate)?;
182183 break;
183184 }
@@ -217,6 +218,7 @@ fn catchup_lhs_with_rhs<R: visit::Record>( · 33 unmodified lines
217218 Some(Ok(lhs)) => match lhs.filename.cmp(rhs.filename) {
218219 Equal => {
219220 let lhs = lhs_entries.next().expect("the peeked item to be present")?;
221+ delegate.pop_path_component();
220222 handle_lhs_and_rhs_with_equal_filenames(lhs, rhs, queue, delegate)?;
221223 break;
222224 }
git-diff/src/visit/mod.rs+6−3
@@ -27,9 +27,12 @@ impl<P: Clone + Default> State<P> { · 26 unmodified lines
2727
2828 pub struct Changes<'a>(Option<immutable::TreeIter<'a>>);
2929
30−impl<'a> From<Option<immutable::TreeIter<'a>>> for Changes<'a> {
31− fn from(v: Option<immutable::TreeIter<'a>>) -> Self {
32− Changes(v)
30+impl<'a, T> From<T> for Changes<'a>
31+where
32+ T: Into<Option<immutable::TreeIter<'a>>>,
33+{
34+ fn from(v: T) -> Self {
35+ Changes(v.into())
3336 }
3437 }
3538

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t