Fix CommitMessage combine wrongly concatenating subject to body

This commit is contained in:
Bruno Gouveia 2021-04-08 18:22:08 +01:00 committed by Stephan Dilly
parent 0a608ae65e
commit 1d90219df9

View file

@ -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(())
}
}