git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] merge: make sure to terminate message with newline

From
LWLuca Weiss <luca@z3ntu.xyz>
Date
Aug 26, 2021, 18:32 UTC
Message-ID
<2333170.ZUCfCSpfzX@g550jk>
In-Reply-To
<YPMXqLESKApq2uPI@coredump.intra.peff.net>
Hi Peff and others,
On Samstag, 17. Juli 2021 19:47:20 CEST Jeff King wrote:
Show 19 quoted lines
> [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?
> 
> -Peff

I 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

Previous: Luca WeissNext: Junio C Hamano
Message 15 of 17 in “Normalize newlines in merge & interpret-trailer”
  1. 0/2 Normalize newlines in merge & interpret-trailerLuca Weiss via GitGitGadget, Jul 16, 2021
  2. 1/2 trailer: handle input without trailing newlineLuca Weiss via GitGitGadget, Jul 16, 2021
  3. Jeff KingJul 16, 2021
  4. 2/2 merge: make sure to terminate message with newlineLuca Weiss via GitGitGadget, Jul 16, 2021
  5. Phillip WoodJul 16, 2021
  6. Luca WeissJul 16, 2021
  7. Phillip WoodJul 16, 2021
  8. Jeff KingJul 16, 2021
  9. Junio C HamanoJul 16, 2021
  10. Jeff KingJul 16, 2021
  11. Junio C HamanoJul 16, 2021
  12. Phillip WoodJul 17, 2021
  13. Jeff KingJul 17, 2021
  14. Luca WeissJul 21, 2021
  15. Luca WeissAug 26, 2021
  16. Junio C HamanoJul 16, 2021
  17. Junio C HamanoJul 16, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.