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

Function capture_event_bytes

atomic-cli/src/commands/git/hooks.rs:1052–1067  ·  view source on GitHub ↗

Capture `event_bytes` through the repository library into the pristine database. Best-effort by design: a failure (lock contention, read-only repository) leaves the event journal-only, which downstream readers honestly treat as unauthenticated rather than operation linkage. The advisory hook must never break Git, so failures become warnings.

(root: &Path, event_bytes: &[u8])

Source from the content-addressed store, hash-verified

1050/// honestly treat as unauthenticated rather than operation linkage. The
1051/// advisory hook must never break Git, so failures become warnings.
1052fn capture_event_bytes(root: &Path, event_bytes: &[u8]) -> CliResult<()> {
1053 if let Err(error) = (|| -> Result<(), CliError> {
1054 let repo = atomic_repository::Repository::open(root)
1055 .map_err(|error| git_error(format!("cannot open the Atomic repository: {error}")))?;
1056 repo.capture_shim_event(event_bytes)
1057 .map_err(|error| git_error(format!("cannot capture shim event: {error}")))?;
1058 Ok(())
1059 })() {
1060 print_warning(&format!(
1061 "post-rewrite event {} was journaled but not captured immutably ({error}); \
1062 it will read as unauthenticated evidence, not operation linkage",
1063 "post-rewrite"
1064 ));
1065 }
1066 Ok(())
1067}
1068
1069/// CB-9B: journal `reference-transaction` evidence from Git's actual wire
1070/// format (review blocker 5): the transaction state arrives as `argv[1]` and

Callers 1

record_post_rewriteFunction · 0.85

Calls 4

openFunction · 0.85
print_warningFunction · 0.85
capture_shim_eventMethod · 0.80
git_errorFunction · 0.70

Tested by

no test coverage detected