[`Fixture::new`] with more files in the base commit.
(files: &[(&str, &str)])
| 33 | |
| 34 | /// [`Fixture::new`] with more files in the base commit. |
| 35 | fn with_base_files(files: &[(&str, &str)]) -> Self { |
| 36 | let dir = tempfile::tempdir().unwrap(); |
| 37 | let fixture = Self { dir }; |
| 38 | fixture.git(&["init", "-q", "-b", "main"]); |
| 39 | fs::write(fixture.root().join("tracked.txt"), b"base\n").unwrap(); |
| 40 | fixture.git(&["add", "tracked.txt"]); |
| 41 | for (path, content) in files { |
| 42 | fixture.write(path, content); |
| 43 | fixture.git(&["add", path]); |
| 44 | } |
| 45 | fixture.git(&["commit", "-q", "-m", "base"]); |
| 46 | fixture.atomic(&["git", "import", "--no-vault"]); |
| 47 | let key = fixture.root().join(".atomic/test-binding.key"); |
| 48 | fs::write(&key, "11".repeat(32)).unwrap(); |
| 49 | fixture.atomic(&[ |
| 50 | "git", |
| 51 | "shim", |
| 52 | "enable", |
| 53 | "--no-refspecs", |
| 54 | "--binding-key-file", |
| 55 | key.to_str().unwrap(), |
| 56 | ]); |
| 57 | fixture.atomic(&["git", "shim", "reconcile"]); |
| 58 | assert!( |
| 59 | fixture.root().join(".git/hooks/pre-commit").exists(), |
| 60 | "shim enable installs the commit-time capture dispatcher" |
| 61 | ); |
| 62 | fixture |
| 63 | } |
| 64 | |
| 65 | fn root(&self) -> &Path { |
| 66 | self.dir.path() |