libgit2 / libgit2/libgit2

git_message_trailers mishandles a trailer with empty value.

Open
#7,094 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
10.6k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

Given a message like this, in which the first trailer has an empty value:

This is a commit message.

EmptyTrailer:
Another: trailer
Last: trailer

git_message_trailers returns only two trailers. The value of the first is a newline character followed by the entire second line ("\nAnother: trailer").

By contrast, "git interpret-trailers" prints the 3 trailers as expected.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the git_message_trailers implementation and compare its parsing behavior with git interpret-trailers for the example message. Done when all three trailers are returned and the first has an empty value instead of consuming the next line; verify the behavior with a regression test for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.