Skip to content

Commit 1d90219

Browse files
Bruno GouveiaStephan Dilly
Bruno Gouveia
authored and
Stephan Dilly
committed
Fix CommitMessage combine wrongly concatenating subject to body
1 parent 0a608ae commit 1d90219

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: asyncgit/src/sync/commit_details.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl CommitMessage {
6060
///
6161
pub fn combine(self) -> String {
6262
if let Some(body) = self.body {
63-
format!("{}{}", self.subject, body)
63+
format!("{}\n{}", self.subject, body)
6464
} else {
6565
self.subject
6666
}
@@ -158,4 +158,13 @@ mod tests {
158158

159159
Ok(())
160160
}
161+
162+
#[test]
163+
fn test_commit_message_combine() -> Result<()> {
164+
let msg = CommitMessage::from("foo\nbar\r\ntest");
165+
166+
assert_eq!(msg.combine(), String::from("foo\nbar\ntest"));
167+
168+
Ok(())
169+
}
161170
}

0 commit comments

Comments
 (0)