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

Function shim_feature_commit

atomic-cli/tests/it/git_shim_logging_test.rs:125–155  ·  view source on GitHub ↗

A shim-enabled repository on `main`, then a commit on `feature` made through Git so its hooks run, reconciled into Atomic.

()

Source from the content-addressed store, hash-verified

123/// A shim-enabled repository on `main`, then a commit on `feature` made
124/// through Git so its hooks run, reconciled into Atomic.
125fn shim_feature_commit() -> Sandbox {
126 let sandbox = Sandbox::new();
127 sandbox.git(&["init", "-q", "-b", "main"]);
128 sandbox.commit("a.txt", "a\n", "one");
129 sandbox.atomic_ok(&["init"]);
130 sandbox.atomic_ok(&["git", "import"]);
131 sandbox.atomic_ok(&["git", "shim", "enable"]);
132
133 // With -v, whose `atomic=debug` would show an `info` line, so the copy
134 // stays off the terminal only because its target is file-only.
135 let aligned = sandbox.atomic_ok(&["-v", "git", "shim", "reconcile"]);
136 let stdout = String::from_utf8_lossy(&aligned.stdout);
137 let stderr = String::from_utf8_lossy(&aligned.stderr);
138 assert_eq!(
139 stdout.matches("Git HEAD already matches").count(),
140 1,
141 "printed once: {stdout}"
142 );
143 assert!(
144 !stderr.contains("Git HEAD already matches"),
145 "the file copy never reaches the terminal: {stderr}"
146 );
147
148 sandbox.git(&["checkout", "-q", "-b", "feature"]);
149 // post-checkout starts a detached observer; let it finish inside the
150 // sandbox before going on.
151 sandbox.wait_for_log(&["cmd=git shim observe-deferred", "command finished"]);
152 sandbox.commit("b.txt", "b\n", "two");
153 sandbox.atomic_ok(&["git", "shim", "reconcile"]);
154 sandbox
155}
156
157#[test]
158fn reconcile_logs_its_decision_and_outcome_inside_its_span() {

Calls 4

wait_for_logMethod · 0.80
gitMethod · 0.45
commitMethod · 0.45
atomic_okMethod · 0.45

Tested by

no test coverage detected