Write a conflict marker line. The format is: `MARKER ID [HASH]` followed by a newline.
(&mut self, marker: &str, id: u32, hash: Option<&Hash>)
| 296 | /// |
| 297 | /// The format is: `MARKER ID [HASH]` followed by a newline. |
| 298 | fn write_marker(&mut self, marker: &str, id: u32, hash: Option<&Hash>) -> std::io::Result<()> { |
| 299 | self.ensure_line_start()?; |
| 300 | |
| 301 | // Write marker and ID |
| 302 | write!(self.writer, "{} {}", marker, id)?; |
| 303 | self.bytes_written += marker.len() as u64 + 1 + count_digits(id) as u64; |
| 304 | |
| 305 | // Write hash if provided |
| 306 | if let Some(h) = hash { |
| 307 | let hash_str = h.to_base32(); |
| 308 | // Only include first 8 chars of hash for readability |
| 309 | let short_hash = if hash_str.len() > 8 { |
| 310 | &hash_str[..8] |
| 311 | } else { |
| 312 | &hash_str |
| 313 | }; |
| 314 | write!(self.writer, " [{}]", short_hash)?; |
| 315 | self.bytes_written += 3 + short_hash.len() as u64; // " [" + hash + "]" |
| 316 | } |
| 317 | |
| 318 | // Write newline |
| 319 | self.writer.write_all(b"\n")?; |
| 320 | self.bytes_written += 1; |
| 321 | self.line += 1; |
| 322 | self.at_line_start = true; |
| 323 | |
| 324 | Ok(()) |
| 325 | } |
| 326 | |
| 327 | /// Record a conflict with the given type. |
| 328 | fn record_conflict(&mut self, conflict_type: FileConflictType, id: u32, hash: Option<&Hash>) { |
no test coverage detected