libgit2 / libgit2

A cross-platform, linkable library implementation of Git that you can use in your application.

Home Page:https://libgit2.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`----` in commit message breaks trailer parsing

robertlacroix opened this issue · comments

git_message_trailers fails to return trailers when the commit message contains 3 or more dashes, because find_patch_start erroneously just looks for --- instead of --- (with a trailing space, like Git does).

Reproduction steps

Try to parse trailers from a commit message like

Commit title

Header
------
Lorem ipsum

Signed-off-by: test@test.com

Expected behavior

git_message_trailers returns Signed-off-by trailer

Actual behavior

git_message_trailers returns no trailers

Version of libgit2 (release number or SHA1)

1.7.2 (a418d9d)

Operating system(s) tested

macOS

Thanks for the report!