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

Re: git commit --cleanup and templates

From
Jeff King <peff@peff.net>
Date
Jan 27, 2010, 11:48 UTC
Message-ID
<20100127114820.GA12656@coredump.intra.peff.net>
In-Reply-To
<hj7bh9$adp$1@ger.gmane.org>
On Wed, Jan 20, 2010 at 05:37:47PM +0100, Sebastian Schuberth wrote:
Show 10 quoted lines
> when I recently for the first time used commit templates, I was
> surprised to see that git by default strips leading empty lines that
> I deliberately added to the template file when opening the template
> in the editor. I understand that I could use a different cleanup
> mode, but in fact I *want* git to clean everything, but only *after*
> I finished editing the commit message, not already when opening the
> editor.
> 
> Before submitting a patch, I'd like to hear what other people think
> about this, or whether I'm overseeing something.

Nobody has responded, so I doubt anybody has strong objections (or maybe they just didn't read your message. :) ).

Personally, the behavior you are proposing makes more sense to me, and I don't think you will really be hurting anybody by changing it. You will not affect the final commit message, but only what the user sees in their editor. And if people are really attached to not having extra whitespace in the editor, then they can simply clean up their templates.

So I would suggest working on a patch if it is something you want.
-Peff
Previous: Sebastian Schuberth
Message 2 of 2 in “git commit --cleanup and templates”
  1. Sebastian SchuberthJan 20, 2010
  2. Jeff KingJan 27, 2010

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.