Bug Report: Multi-line trailers containing empty lines break parsing
From: Matthias Buehlmann <hidden>
Date: 2021-02-15 21:56:26
Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.
What did you do before the bug happened? (Steps to reproduce your issue)
create a file containing multiline trailer:
$ echo "Test" > test.txt
$ git interpret-trailers --where end --if-exists addIfDifferent
--trailer "SingleLineTrailer: This is a single line trailer"
--in-place test.txt
$ git interpret-trailers --where end --if-exists addIfDifferent
--trailer "MultiLineTrailer: This is"$'\n a folded multi-line\n
trailer' --in-place test.txt
parse trailers:
$ git interpret-trailers --parse test.txt
SingleLineTrailer: This is a single line trailer
MultiLineTrailer: This is a folded multi-line trailer
(so far, all is as expected)
now, adding multiline trailer containing empty line:
$ git interpret-trailers --where end --if-exists addIfDifferent
--trailer "MultiLineTrailer: This is"$'\n a folded multi-line\n
trailer which\n \n contains an\n empty line' --in-place test.txt
parse trailers again:
$ git interpret-trailers --parse test.txt
What did you expect to happen? (Expected behavior)
I would expect the following output:
$ git interpret-trailers --parse test.txt
SingleLineTrailer: This is a single line trailer
MultiLineTrailer: This is a folded multi-line trailer
MultiLineTrailer: This is a folded multi-line trailer which
contains an empty line
What happened instead? (Actual behavior)
no output is generated, but exit code is nevertheless 0:
$ git interpret-trailers --parse test.txt
$ echo $?
0
What's different between what you expected and what actually happened?
I would expect either to get an output or the call to exit non-zero
Anything else you want to add:
According to my interpretation of the documentation of git
intepret-trailers, empty lines should be supported if properly folded,
in the same way as for example the PGP signature added to the commit
header contains a (properly folded) empty line
Please review the rest of the bug report below.
You can delete any lines you don't wish to share.
[System Info]
git version:
git version 2.30.0.windows.2
cpu: x86_64
built from commit: f8cbc844b81bf6b9e72178bbe891a86c8bf5e9e7
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
uname: Windows 10.0 18363
compiler info: gnuc: 10.2
libc info: no libc information available
$SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe
[Enabled Hooks]
post-commit