Skip to content

Normalize newlines in merge & interpret-trailer

Luca Weiss via GitGitGadget git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2trailer: handle input without trailing newlinet/t7513-interpret-trailers.sh trailer.c+10 -01 reply
2/2merge: make sure to terminate message with newlinebuiltin/merge.c+1 -012 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Normalize newlines in merge & interpret-trailer

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

Signature · 1 line
gitgitgadget