diff --git a/giterated-daemon/src/backend/git.rs b/giterated-daemon/src/backend/git.rs index 58da38d..36c446a 100644 --- a/giterated-daemon/src/backend/git.rs +++ b/giterated-daemon/src/backend/git.rs @@ -769,9 +769,14 @@ impl RepositoryBackend for GitBackend { for chunk_num in 0..patch.num_hunks() { if let Ok((chunk, chunk_num_lines)) = patch.hunk(chunk_num) { let mut lines: Vec = vec![]; + lines.push(format!("chunk_num_lines: {}", chunk_num_lines)); + for line_num in 0..chunk_num_lines { + lines.push(format!("line_num: {}", line_num)); if let Ok(line) = patch.line_in_hunk(chunk_num, line_num) { + lines.push(format!("line_in_hunk: {}", line_num)); if let Ok(line_utf8) = String::from_utf8(line.content().to_vec()) { + lines.push(format!("line_utf8: {}", line_num)); lines.push(line_utf8); } @@ -782,6 +787,7 @@ impl RepositoryBackend for GitBackend { } chunks.push(RepositoryDiffFileChunk { + header: String::from_utf8(chunk.header().to_vec()).ok(), old_start: chunk.old_start(), old_lines: chunk.old_lines(), new_start: chunk.new_start(), diff --git a/giterated-models/src/repository/mod.rs b/giterated-models/src/repository/mod.rs index a76449a..ebed7e2 100644 --- a/giterated-models/src/repository/mod.rs +++ b/giterated-models/src/repository/mod.rs @@ -230,6 +230,8 @@ pub struct RepositoryDiffFileInfo { /// Represents a single chunk of a file diff #[derive(Clone, Debug, Serialize, Deserialize)] pub struct RepositoryDiffFileChunk { + /// Header of the chunk + pub header: Option, /// Starting line number of the old file pub old_start: u32, /// Number of lines in "from" side of this chunk