| 58 | } |
| 59 | |
| 60 | fn new(preinit: bool) -> Self { |
| 61 | let fixture = Self { |
| 62 | root: TempDir::new().unwrap(), |
| 63 | home: TempDir::new().unwrap(), |
| 64 | }; |
| 65 | fixture.git(&["init", "-q", "-b", "main"]); |
| 66 | fs::write(fixture.root.path().join("tracked.txt"), b"base\n").unwrap(); |
| 67 | fixture.git(&["add", "tracked.txt"]); |
| 68 | fixture.git(&["commit", "-qm", "base"]); |
| 69 | if preinit { |
| 70 | fixture.atomic(&["init", "--no-vault"]); |
| 71 | assert!(fixture.root.path().join(".atomicignore").exists()); |
| 72 | } |
| 73 | fixture.atomic(&["git", "import", "--no-vault"]); |
| 74 | let key = fixture.home.path().join("binding.key"); |
| 75 | fs::write(&key, "42".repeat(32)).unwrap(); |
| 76 | fixture.atomic(&[ |
| 77 | "git", |
| 78 | "shim", |
| 79 | "enable", |
| 80 | "--binding-key-file", |
| 81 | key.to_str().unwrap(), |
| 82 | ]); |
| 83 | fixture.atomic(&["git", "shim", "reconcile"]); |
| 84 | fixture |
| 85 | } |
| 86 | |
| 87 | fn assert_content(&self, view: &str, path: &str, expected: &[u8]) { |
| 88 | // Reopen and render from canonical data, independently of the Git worktree. |