()
| 41 | |
| 42 | impl Fixture { |
| 43 | fn new() -> Self { |
| 44 | let root = TempDir::new().unwrap(); |
| 45 | let home = TempDir::new().unwrap(); |
| 46 | atomic(root.path(), home.path(), &["init", "--no-vault"]); |
| 47 | fs::write(root.path().join("old.txt"), BASE).unwrap(); |
| 48 | #[cfg(unix)] |
| 49 | { |
| 50 | use std::os::unix::fs::PermissionsExt; |
| 51 | fs::set_permissions( |
| 52 | root.path().join("old.txt"), |
| 53 | fs::Permissions::from_mode(0o644), |
| 54 | ) |
| 55 | .unwrap(); |
| 56 | } |
| 57 | atomic(root.path(), home.path(), &["add", "old.txt"]); |
| 58 | atomic( |
| 59 | root.path(), |
| 60 | home.path(), |
| 61 | &["record", "-am", "base", "--author", "Rename Test"], |
| 62 | ); |
| 63 | assert!(!root.path().join(".git").exists()); |
| 64 | let mut repo = Repository::open(root.path()).unwrap(); |
| 65 | let inode = repo.get_file_inode("old.txt").unwrap().unwrap(); |
| 66 | let txn = repo.pristine().read_txn().unwrap(); |
| 67 | let position = txn.inode_position(inode).unwrap().unwrap(); |
| 68 | let trunk = decode_trunk_id(&txn.get_crdt_inode_trunk(inode.get()).unwrap().unwrap()); |
| 69 | drop(txn); |
| 70 | let current = repo.current_view().to_string(); |
| 71 | repo.create_view_from("before-rename", ¤t).unwrap(); |
| 72 | repo.create_view_from("rename-work", ¤t).unwrap(); |
| 73 | repo.switch_view(repo.require_working_copy_id().unwrap(), "rename-work") |
| 74 | .unwrap(); |
| 75 | Self { |
| 76 | root, |
| 77 | home, |
| 78 | inode, |
| 79 | position, |
| 80 | trunk, |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | fn atomic(&self, args: &[&str]) { |
| 85 | atomic(self.root.path(), self.home.path(), args); |
nothing calls this directly
no test coverage detected