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

Method normalized

atomic-repository/src/repository/conflict_object.rs:250–274  ·  view source on GitHub ↗

The store-independent view of this conflict set. Inode numbers are per-store sequential ids (allocated from a process counter), so a fresh store restores the same conflicts under different numbers. Conflict SIDES are a set, not a sequence: the renderer's presentation order between two stores can differ (SCC tie-breaks use store-local internal ids), so the normalized form sorts sides by their stab

(&self)

Source from the content-addressed store, hash-verified

248 /// the raw inode stays in the object as store-local graph metadata for
249 /// status and repair tooling.
250 pub fn normalized(&self) -> Self {
251 let mut normalized = self.clone();
252 for file in &mut normalized.files {
253 file.inode = 0;
254 for entry in &mut file.entries {
255 entry.sides.sort_by(|left, right| {
256 left.change
257 .as_bytes()
258 .cmp(right.change.as_bytes())
259 .then(left.start.cmp(&right.start))
260 .then(left.end.cmp(&right.end))
261 });
262 for side in &mut entry.sides {
263 side.content = Hash::from_bytes([0u8; 32]);
264 }
265 if let Some(base) = entry.base.as_mut() {
266 base.content = Hash::from_bytes([0u8; 32]);
267 }
268 for claimant in &mut entry.claimants {
269 claimant.inode = 0;
270 }
271 }
272 }
273 normalized
274 }
275
276 /// Canonical bytes: magic + version + deterministic postcard payload of
277 /// the normalized (store-independent) object.

Callers 2

canonical_bytesMethod · 0.80

Calls 3

cloneMethod · 0.45
cmpMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected