wip: improve whitespace handling in paragraph parsing

This commit is contained in:
2020-10-31 19:55:56 +00:00
parent 67c89f0df1
commit 5d205a639c
2 changed files with 59 additions and 21 deletions

View File

@@ -34,10 +34,14 @@ func parseHeader(header []byte) (*Commit, error) {
}, nil
}
func paragraphs(input []byte) [][]byte {
paras := bytes.Split(normlizeLinefeeds(input), []byte{lf, lf})
func paragraphs(commitMsg []byte) [][]byte {
paras := bytes.Split(
bytes.TrimSpace(normlizeLinefeeds(commitMsg)),
[]byte{lf, lf},
)
for i, p := range paras {
paras[i] = bytes.Trim(p, crlf)
paras[i] = bytes.TrimSpace(p)
}
return paras