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

Function digest_index

atomic-cli/src/commands/git/observation.rs:1201–1215  ·  view source on GitHub ↗
(entries: &[IndexEntryObservation])

Source from the content-addressed store, hash-verified

1199}
1200
1201fn digest_index(entries: &[IndexEntryObservation]) -> CanonicalIndexDigest {
1202 let mut hasher = blake3::Hasher::new();
1203 hasher.update(INDEX_DIGEST_DOMAIN);
1204 hasher.update(&(entries.len() as u64).to_le_bytes());
1205 for entry in entries {
1206 hasher.update(&(entry.path.len() as u64).to_le_bytes());
1207 hasher.update(&entry.path);
1208 hasher.update(&[entry.stage]);
1209 hasher.update(entry.oid.as_bytes());
1210 hasher.update(&entry.mode.to_le_bytes());
1211 hasher.update(&entry.flags.to_le_bytes());
1212 hasher.update(&entry.flags_extended.to_le_bytes());
1213 }
1214 CanonicalIndexDigest(hasher.finalize().to_hex().to_string())
1215}
1216
1217fn observe_locks(paths: &GitAdminPaths) -> Result<LockObservation, ObservationError> {
1218 let index_lock_path = append_suffix(&paths.index_path, ".lock");

Callers 1

observe_indexFunction · 0.85

Calls 7

to_le_bytesMethod · 0.80
updateMethod · 0.45
lenMethod · 0.45
as_bytesMethod · 0.45
to_hexMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected