Every ordinary command used in the reported sequence succeeds natively, and none of them touches the user's Git index, refs, or hooks.
(fixture: &Fixture, git_index_before: &str)
| 180 | /// Every ordinary command used in the reported sequence succeeds natively, |
| 181 | /// and none of them touches the user's Git index, refs, or hooks. |
| 182 | fn assert_native_workflow(fixture: &Fixture, git_index_before: &str) { |
| 183 | fs::write(fixture.root().join("f.txt"), b"hello\n").unwrap(); |
| 184 | fixture.atomic_ok(&["add", "f.txt"]); |
| 185 | fixture.atomic_ok(&["status"]); |
| 186 | let json = fixture.atomic_ok(&["status", "--json"]); |
| 187 | serde_json::from_slice::<Value>(&json.stdout).expect("status --json emits JSON"); |
| 188 | fixture.atomic_ok(&["record", "-m", "first"]); |
| 189 | |
| 190 | fs::write(fixture.root().join("f.txt"), b"hello again\n").unwrap(); |
| 191 | let diff = fixture.atomic_ok(&["diff", "--name-only", "--no-color"]); |
| 192 | assert!(output_text(&diff).contains("f.txt")); |
| 193 | fixture.atomic_ok(&["stash", "push"]); |
| 194 | fixture.atomic_ok(&["stash", "pop"]); |
| 195 | assert_eq!( |
| 196 | fs::read(fixture.root().join("f.txt")).unwrap(), |
| 197 | b"hello again\n" |
| 198 | ); |
| 199 | fixture.atomic_ok(&["tag", "create", "v1"]); |
| 200 | |
| 201 | assert_eq!( |
| 202 | fixture.git_text(&["ls-files", "--stage"]), |
| 203 | git_index_before, |
| 204 | "ordinary Atomic commands must not write the Git index without the shim opt-in" |
| 205 | ); |
| 206 | assert_eq!( |
| 207 | fixture.git_text(&["tag", "--list"]), |
| 208 | "", |
| 209 | "`atomic tag create` must not export Git tags without the shim opt-in" |
| 210 | ); |
| 211 | assert!( |
| 212 | fixture.hooks_installed().is_empty(), |
| 213 | "no Git hooks may be installed without the opt-in: {:?}", |
| 214 | fixture.hooks_installed() |
| 215 | ); |
| 216 | assert!(!fixture |
| 217 | .root() |
| 218 | .join(".atomic/bridge/workspace.json") |
| 219 | .exists()); |
| 220 | } |
| 221 | |
| 222 | #[test] |
| 223 | fn fresh_git_init_without_shim_keeps_native_commands_working() { |
no test coverage detected