Showing the changes to git-object/src/mutable/commit.rs (1 of 4 files). Show all
Unified · Split
| @@ -1,6 +1,6 @@ | |||
| 1 | use crate::{ | 1 | use crate::{ |
| 2 | commit, | 2 | commit, |
| 3 | mutable::{self, ser, NL}, | 3 | mutable::{self, encode, NL}, |
| 4 | }; | 4 | }; |
| 5 | use bstr::{BStr, BString, ByteSlice}; | 5 | use bstr::{BStr, BString, ByteSlice}; |
| 6 | use smallvec::SmallVec; | 6 | use smallvec::SmallVec; |
| @@ -37,21 +37,21 @@ impl Commit { · 30 unmodified lines | |||
| 37 | } | 37 | } |
| 38 | /// Serializes this instance to `out` in the git serialization format. | 38 | /// Serializes this instance to `out` in the git serialization format. |
| 39 | pub fn write_to(&self, mut out: impl io::Write) -> io::Result<()> { | 39 | pub fn write_to(&self, mut out: impl io::Write) -> io::Result<()> { |
| 40 | ser::trusted_header_id(b"tree", &self.tree, &mut out)?; | 40 | encode::trusted_header_id(b"tree", &self.tree, &mut out)?; |
| 41 | for parent in &self.parents { | 41 | for parent in &self.parents { |
| 42 | ser::trusted_header_id(b"parent", parent, &mut out)?; | 42 | encode::trusted_header_id(b"parent", parent, &mut out)?; |
| 43 | } | 43 | } |
| 44 | ser::trusted_header_signature(b"author", &self.author, &mut out)?; | 44 | encode::trusted_header_signature(b"author", &self.author, &mut out)?; |
| 45 | ser::trusted_header_signature(b"committer", &self.committer, &mut out)?; | 45 | encode::trusted_header_signature(b"committer", &self.committer, &mut out)?; |
| 46 | if let Some(encoding) = self.encoding.as_ref() { | 46 | if let Some(encoding) = self.encoding.as_ref() { |
| 47 | ser::header_field(b"encoding", encoding, &mut out)?; | 47 | encode::header_field(b"encoding", encoding, &mut out)?; |
| 48 | } | 48 | } |
| 49 | for (name, value) in &self.extra_headers { | 49 | for (name, value) in &self.extra_headers { |
| 50 | let has_newline = value.find_byte(b'\n').is_some(); | 50 | let has_newline = value.find_byte(b'\n').is_some(); |
| 51 | if has_newline { | 51 | if has_newline { |
| 52 | ser::header_field_multi_line(name, value, &mut out)?; | 52 | encode::header_field_multi_line(name, value, &mut out)?; |
| 53 | } else { | 53 | } else { |
| 54 | ser::trusted_header_field(name, value, &mut out)?; | 54 | encode::trusted_header_field(name, value, &mut out)?; |
| 55 | } | 55 | } |
| 56 | } | 56 | } |
| 57 | out.write_all(NL)?; | 57 | out.write_all(NL)?; |