Subject: [PATCH 0/2] Normalize newlines in merge & interpret-trailer

From: "Luca Weiss via GitGitGadget" <[email-masked]>
Date: Fri, 16 Jul 2021 07:43:34 +0000

These two patches fix a problem where the trailer would be appended to the
commit message without an empty line, so parsing the trailers again
afterwards would fail.

In practice either one of the patches fixes the exact behavior I see but in
both cases it makes sense to normalize the newlines.

The exact use case where this issue was found is a "git merge --no-edit"
with a commit-msg hook that adds a trailer immediately afterwards. The input
the commit-msg script gets is not terminated by a newline (which is fixed by
the second commit) while the first one makes interpret-trailer capable of
handling such input without a final newline.

Luca Weiss (2):
  trailer: handle input without trailing newline
  merge: make sure to terminate message with newline

 builtin/merge.c               | 1 +
 t/t7513-interpret-trailers.sh | 7 +++++++
 trailer.c                     | 3 +++
 3 files changed, 11 insertions(+)

base-commit: 75ae10bc75336db031ee58d13c5037b929235912
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1048%2Fz3ntu%2Fmaster-newline-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1048/z3ntu/master-newline-v1
Pull-Request: https://github.com/git/git/pull/1048
-- 
gitgitgadget