mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 09:28:21 +00:00
Fix CommitMessage combine wrongly concatenating subject to body
This commit is contained in:
parent
0a608ae65e
commit
1d90219df9
1 changed files with 10 additions and 1 deletions
|
|
@ -60,7 +60,7 @@ impl CommitMessage {
|
||||||
///
|
///
|
||||||
pub fn combine(self) -> String {
|
pub fn combine(self) -> String {
|
||||||
if let Some(body) = self.body {
|
if let Some(body) = self.body {
|
||||||
format!("{}{}", self.subject, body)
|
format!("{}\n{}", self.subject, body)
|
||||||
} else {
|
} else {
|
||||||
self.subject
|
self.subject
|
||||||
}
|
}
|
||||||
|
|
@ -158,4 +158,13 @@ mod tests {
|
||||||
|
|
||||||
Ok(())
|
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(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue