Re: [PATCH 2/2] merge: make sure to terminate message with newline
From: Luca Weiss <hidden>
Date: 2021-08-26 18:40:16
Hi Peff and others, On Samstag, 17. Juli 2021 19:47:20 CEST Jeff King wrote:
[cut]
So I think we'd probably want to see a 3-patch series:
1. Make interpret-trailers handle input missing the final newline.
This isn't strictly necessary after patches 2 and 3, but it makes
sense to be more robust with unexpected input.
2. Drop the newline-stripping from prepare_merge_message(). The
examples above show some ways we could cover this in the tests.
This will help --no-edit case, but also using merge.log with "-m"
or "-F".
3. Teach prepare_to_commit() to add the extra newline before letting
hooks see the message. This should probably be done only when
cleanup_mode != COMMIT_MSG_CLEANUP_NONE.
Luca, do you want to try revising your series in that direction?
-PeffI haven't found time to revisit the patches yet but I have found another unexpected behavior with git merge that is shown with these commands: # git needs to be set up to sign commits with gpg mkdir /tmp/test cd /tmp/test git init git commit --allow-empty -m "Foo1" git commit --allow-empty -m "Foo2" git tag -s tag_foo -m "foooo!" git checkout HEAD~1 git merge --no-ff --no-edit --log -m "Merge tag_foo" tag_foo # git show There are two problems with the resulting commit message: * The newline between -m message and tag message is missing * There's a big pgp signature (BEGIN PGP SIGNATURE) block included in the commit message. When using an editor this would be removed because the text starts with comments. I don't think I have enough insight into where to fix this so I'd appreciate if somebody else could fix it :) Regards Luca