MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / assert_native_workflow

Function assert_native_workflow

atomic-cli/tests/it/git_shim_opt_in_test.rs:182–220  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
182fn 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]
223fn fresh_git_init_without_shim_keeps_native_commands_working() {

Calls 4

writeFunction · 0.70
unwrapMethod · 0.45
rootMethod · 0.45
atomic_okMethod · 0.45

Tested by

no test coverage detected