Fix CommitMessage combine wrongly concatenating subject to body
@@ -60,7 +60,7 @@ impl CommitMessage {
///
pub fn combine(self) -> String {
if let Some(body) = self.body {
- format!("{}{}", self.subject, body)
+ format!("{}\n{}", self.subject, body)
} else {
self.subject
}
@@ -158,4 +158,13 @@ mod tests {
Ok(())
}
+
+ #[test]
+ fn test_commit_message_combine() -> Result<()> {
+ let msg = CommitMessage::from("foo\nbar\r\ntest");
+
+ assert_eq!(msg.combine(), String::from("foo\nbar\ntest"));
+
+ Ok(())
+ }
}
