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

[Bug] commit-tree shouldn't append an extra newline to commit messages

From
Ross Kabus <rkabus@aerotech.com>
Date
Sep 1, 2017, 18:58 UTC
Message-ID
<CAEVs+za9do_wXC12SSRznF9v9oGw3_Grq2EFDVf8nH1CRgM-Qw@mail.gmail.com>
Hello,

When doing git commit-tree to manually create a commit object, it can be seen that the resulting commit's message has an extra appended newline (\n) that was not present in the input for either argument -m or -F. This is both undesirable and inconsistent with the git commit porcelain command.

In code this happens in the file "builtin\commit-tree.c" lines #80 and #105 (these lines numbers are the same for master, maint, and next branches). It seems like the calls to "strbuf_complete_line()" should just be removed to preserve the original input message exactly. As far as I can tell removing this call doesn't have any unintended side-effects.

git version 2.13.1.windows.2

Thanks, Ross

Next: Jeff King
Message 1 of 10 in “[Bug] commit-tree shouldn't append an extra newline to commit messages”
  1. Ross KabusSep 1, 2017
  2. Jeff KingSep 2, 2017
  3. Ross KabusSep 5, 2017
  4. Jeff KingSep 5, 2017
  5. Ross KabusSep 5, 2017
  6. Jeff KingSep 5, 2017
  7. Ross KabusSep 5, 2017
  8. Ross KabusSep 5, 2017
  9. Jeff KingSep 7, 2017
  10. Junio C HamanoSep 5, 2017

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.