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

Method change_bytes

atomic-cli/tests/it/git_adoption_cb7b_test.rs:252–264  ·  view source on GitHub ↗

The decoded bytes of a content-addressed change (contents, hunks, and hashed metadata) for store-level assertions.

(&self, hash_hex: &str)

Source from the content-addressed store, hash-verified

250 /// The decoded bytes of a content-addressed change (contents, hunks, and
251 /// hashed metadata) for store-level assertions.
252 fn change_bytes(&self, hash_hex: &str) -> Vec<u8> {
253 use atomic_core::types::Base32;
254 let repository =
255 atomic_repository::Repository::open_readonly(self.root()).expect("open repository");
256 let hash = atomic_core::types::Hash::from_base32(hash_hex.as_bytes()).expect("change hash");
257 let change = repository.load_change(&hash).expect("load change");
258 let mut bytes = change.contents.clone();
259 bytes.extend_from_slice(&change.hashed.metadata);
260 for operation in change.hunks() {
261 bytes.extend(format!("{operation:?}").into_bytes());
262 }
263 bytes
264 }
265
266 /// Capture pending-edit evidence (`atomic status` through the Reconcile
267 /// boundary).

Calls 6

extendMethod · 0.80
rootMethod · 0.45
as_bytesMethod · 0.45
load_changeMethod · 0.45
cloneMethod · 0.45
hunksMethod · 0.45

Tested by

no test coverage detected