Save a change using pre-serialized V3 bytes (hash-stable). This writes the exact V3 bytes to disk, ensuring the file hash matches the hash registered in the pristine graph. Without this, re-serializing the deserialized Change can produce a different hash (different hash table ordering, different chunk boundaries, etc.), causing "change not found" errors on push. # Arguments `hash` - The content
(
&self,
hash: &Hash,
v3_bytes: &[u8],
_change: &Change,
)
| 104 | /// * `v3_bytes` - The exact V3 bytes to write to disk |
| 105 | /// * `_change` - The deserialized Change (unused, kept for API compatibility) |
| 106 | pub(crate) fn save_change_bytes( |
| 107 | &self, |
| 108 | hash: &Hash, |
| 109 | v3_bytes: &[u8], |
| 110 | _change: &Change, |
| 111 | ) -> Result<Hash, RepositoryError> { |
| 112 | // Write the exact V3 bytes to the file store (no re-serialization). |
| 113 | // This ensures the hash in the filename matches the hash in the pristine. |
| 114 | let change_path = self.change_store.change_path(hash); |
| 115 | if let Some(parent) = change_path.parent() { |
| 116 | std::fs::create_dir_all(parent)?; |
| 117 | } |
| 118 | std::fs::write(&change_path, v3_bytes)?; |
| 119 | |
| 120 | Ok(*hash) |
| 121 | } |
| 122 | |
| 123 | /// Load a change from the repository. |
| 124 | /// |
no test coverage detected