| 678 | } |
| 679 | |
| 680 | fn output_conflict_marker( |
| 681 | &mut self, |
| 682 | marker: &str, |
| 683 | id: usize, |
| 684 | changes: Option<&[Hash]>, |
| 685 | ) -> Result<(), std::io::Error> { |
| 686 | // Ensure we're on a new line |
| 687 | if !self.at_newline { |
| 688 | self.writer.write_all(b"\n")?; |
| 689 | } |
| 690 | |
| 691 | // Write marker and ID |
| 692 | write!(self.writer, "{} {}", marker, id)?; |
| 693 | |
| 694 | // Write change hashes if provided |
| 695 | if let Some(hashes) = changes { |
| 696 | for hash in hashes { |
| 697 | let b32 = hash.to_base32(); |
| 698 | let short = if b32.len() >= 8 { &b32[..8] } else { &b32 }; |
| 699 | write!(self.writer, " [{}]", short)?; |
| 700 | } |
| 701 | } |
| 702 | |
| 703 | self.writer.write_all(b"\n")?; |
| 704 | self.at_newline = true; |
| 705 | Ok(()) |
| 706 | } |
| 707 | } |
| 708 | |
| 709 | // TESTS |