From 2140b14064ffe6b12ba6818b2894d1461a943fb9 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Fri, 25 Feb 2011 03:07:57 -0600 Subject: 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 Signed-off-by: Junio C Hamano --- builtin/commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/commit.c b/builtin/commit.c index 6e2f12accc..cc16e3f292 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -602,7 +602,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix, if (strbuf_read_file(&sb, git_path("SQUASH_MSG"), 0) < 0) die_errno("could not read SQUASH_MSG"); hook_arg1 = "squash"; - } else if (template_file && !stat(template_file, &statbuf)) { + } else if (template_file) { if (strbuf_read_file(&sb, template_file, 0) < 0) die_errno("could not read '%s'", template_file); hook_arg1 = "template"; -- cgit v1.2.3