Chunk header and debug lines
parent: tbd commit: 09583e4
Showing 2 changed files with 8 insertions and 0 deletions
giterated-daemon/src/backend/git.rs
@@ -769,9 +769,14 @@ impl RepositoryBackend for GitBackend { | ||
769 | 769 | for chunk_num in 0..patch.num_hunks() { |
770 | 770 | if let Ok((chunk, chunk_num_lines)) = patch.hunk(chunk_num) { |
771 | 771 | let mut lines: Vec<String> = vec![]; |
772 | lines.push(format!("chunk_num_lines: {}", chunk_num_lines)); | |
773 | ||
772 | 774 | for line_num in 0..chunk_num_lines { |
775 | lines.push(format!("line_num: {}", line_num)); | |
773 | 776 | if let Ok(line) = patch.line_in_hunk(chunk_num, line_num) { |
777 | lines.push(format!("line_in_hunk: {}", line_num)); | |
774 | 778 | if let Ok(line_utf8) = String::from_utf8(line.content().to_vec()) { |
779 | lines.push(format!("line_utf8: {}", line_num)); | |
775 | 780 | lines.push(line_utf8); |
776 | 781 | } |
777 | 782 | |
@@ -782,6 +787,7 @@ impl RepositoryBackend for GitBackend { | ||
782 | 787 | } |
783 | 788 | |
784 | 789 | chunks.push(RepositoryDiffFileChunk { |
790 | header: String::from_utf8(chunk.header().to_vec()).ok(), | |
785 | 791 | old_start: chunk.old_start(), |
786 | 792 | old_lines: chunk.old_lines(), |
787 | 793 | new_start: chunk.new_start(), |
giterated-models/src/repository/mod.rs
@@ -230,6 +230,8 @@ pub struct RepositoryDiffFileInfo { | ||
230 | 230 | /// Represents a single chunk of a file diff |
231 | 231 | #[derive(Clone, Debug, Serialize, Deserialize)] |
232 | 232 | pub struct RepositoryDiffFileChunk { |
233 | /// Header of the chunk | |
234 | pub header: Option<String>, | |
233 | 235 | /// Starting line number of the old file |
234 | 236 | pub old_start: u32, |
235 | 237 | /// Number of lines in "from" side of this chunk |