Skip to content

Commit 1eb961c

Browse files
committed
tree-diff] another test
1 parent 03f87fe commit 1eb961c

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

git-diff/src/visit/changes.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ impl<'a> visit::Changes<'a> {
100100
)?;
101101
break 'inner_less;
102102
} else {
103-
todo!("need test: inner loop handle cursor next");
104-
// delegate.pop_path_component();
105-
// delete_entry_schedule_recursion(lhs, &mut state.trees, delegate)?;
103+
delegate.pop_path_component();
104+
delete_entry_schedule_recursion(lhs, &mut state.trees, delegate)?;
106105
}
107106
}
108107
None => {

git-diff/tests/fixtures/make_diff_repo.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,6 @@ mkdir g
6666
touch g/a
6767
git add g
6868
git commit -qam 'add g/a'
69+
70+
git rm c d e
71+
git commit -qam 'remove /c /d /e'

git-diff/tests/visit/mod.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ mod changes {
1515
const COMMIT_13: &str = "05533d594489fae72d4e7422fbdf061c1b70bc22";
1616
const COMMIT_14: &str = "ac7c4c37c3939b820f3ff9003a7ed11d6143dc2b";
1717
const COMMIT_15: &str = "6112ecdac98a18bcbdbd83f0b180b3e1df12e293";
18+
const COMMIT_16: &str = "0ca25edc0c0b38fd6b6a0f6e4797dc08bf0c55c2";
1819

1920
fn db() -> crate::Result<linked::Db> {
2021
linked::Db::at(
@@ -257,6 +258,29 @@ mod changes {
257258
],
258259
":000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A g/a"
259260
);
261+
assert_eq!(
262+
diff_with_previous_commit_from(&db, COMMIT_16)?,
263+
vec![
264+
recorder::Change::Deletion {
265+
entry_mode: EntryMode::Blob,
266+
oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"),
267+
path: "c".into()
268+
},
269+
recorder::Change::Deletion {
270+
entry_mode: EntryMode::Blob,
271+
oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"),
272+
path: "d".into()
273+
},
274+
recorder::Change::Deletion {
275+
entry_mode: EntryMode::Blob,
276+
oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"),
277+
path: "e".into()
278+
},
279+
],
280+
":100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D c
281+
:100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D d
282+
:100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D e"
283+
);
260284
Ok(())
261285
}
262286
}

0 commit comments

Comments
 (0)