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

Re: [PATCH 1/2] commit: do not cleanup template

From
Junio C Hamano <gitster@pobox.com>
Date
May 7, 2011, 20:13 UTC
Message-ID
<7vwri2uv4m.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1304783624-9919-1-git-send-email-billiob@gmail.com>

These two commits change the longstanding behaviour. It is hard to tell if the existing behaviour is something people who use commit log message templates have relied on (in which case your patch will be a regression to them) or they all shared the sense of annoyance and have been wishing to be improved (in which case nobody will be inconvenienced with your patch). They need to be explained a bit better why these changes are needed.

My gut feeling is that it is relatively easy to justify [1/2]. We prepare the message file to be edited by the committer in sb by reading from different message sources, and usually we would want to clean up what is in sb before writing it out, but you may want to enforce a particular format by using the template (such as having a leading whitespace) and the way to tweak and fix that appearance should be by editing the template, not by automatically running stripspace() here [*1*] when the message came from the template.

I cannot tell offhand how you justify [2/2], though. What motivated you to remove this blank line? At this point in the codepath, it does not look like it should matter if the original message came from your template or from somewhere else.

If the blank line is unneeded after "# You may be committing a merge..." for readability, wouldn't that blank line be unneeded when you took the message from other places, no?

It might make sense to move that newline before "if (whence != FROM_COMMIT)" block, though, to make the logic easier to follow, regardless of the use of the template file.

[Footnote]

*1* I however have a feeling that this call is here because other people wanted to clean it up here because otherwise mistakes like trailing whitespaces or excess blank lines and whatnot made in the template will propagate down to the actual commit log message. But we run stripspace again after the editor returns, so I think that worry is unfounded if we are using an editor.

Previous: Boris FaureNext: Boris 'billiob' Faure
Message 3 of 11 in “commit: do not cleanup template”
  1. 1/2 commit: do not cleanup templateBoris Faure, May 7, 2011
  2. 2/2 commit: do not add a newline after a templateBoris Faure, May 7, 2011
  3. Junio C HamanoMay 7, 2011
  4. Boris 'billiob' FaureMay 7, 2011
  5. Junio C HamanoMay 7, 2011
  6. Sebastian SchuberthMay 8, 2011
  7. Sebastian SchuberthMay 8, 2011
  8. Do not strip empty lines / trailing spaces from a commit message templateBoris Faure, May 8, 2011
  9. Sebastian SchuberthMay 8, 2011
  10. Junio C HamanoMay 8, 2011
  11. Do not strip empty lines / trailing spaces from a commit message templateBoris Faure, May 8, 2011

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.