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

Re: [BUG] Git won't commit

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Aug 13, 2011, 21:18 UTC
Message-ID
<20110813211852.GA17228@elie.gateway.2wire.net>
In-Reply-To
<CAMOZ1Bu3AoQb330hkL+8hDTCvKX+amRfPE3PBxDHUZR17N344Q@mail.gmail.com>
Hi,
Michael Witten wrote:
> As for why one version works but the other does not, I'm not sure.
It's my fault, I'm afraid:
 $ git log v1.7.4..v1.7.4.4 --grep=template --no-merges
 commit 2140b140
 Author: Jonathan Nieder <jrnieder@gmail.com>
 Date:   Fri Feb 25 03:07:57 2011 -0600
     commit: error out for missing commit message template
     When "git commit" was rewritten in C (v1.5.4-rc0~78^2~30,
     2007-11-08), a subtle bug in --template was introduced.  If the
     file named by a --template parameter is missing, previously git
     would error out with a message:
         Commit template file does not exist.
     but in the C version the --template parameter gets ignored and
     the default template is used.
     t7500 has two tests for this case which would have caught it, except
     that with the default $EDITOR, the commit message template is left
     unmodified, causing 'git commit' to error out and the test to
     succeed.
     Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
     Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fabricio, do you remember what you were trying to do when the "[commit] template" configuration got set? Currently the error message says

	fatal: could not read '<path>'

where <path> is the configured template filename; probably this should be changed to mention (1) that the file we were expecting to find is a commit message template and (2) whether we got it from the commandline or configuration.

What I'm trying to figure out is whether other people were relying on the accidental "optional template" behavior or if there is some case where it is more useful. If so, it should be brought back.

Previous: Michael WittenNext: Jonathan Nieder
Message 5 of 7 in “[BUG] Git won't commit”
  1. Fabricio NascimentoAug 12, 2011
  2. Fabricio NascimentoAug 12, 2011
  3. Michael WittenAug 12, 2011
  4. Michael WittenAug 13, 2011
  5. Jonathan NiederAug 13, 2011
  6. commit: clarify "could not read 'template'" messageJonathan Nieder, Aug 19, 2011
  7. Junio C HamanoAug 19, 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.