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

[PATCH 1/5] builtin-commit.c: Use 'git_config_string' to get 'commit.template'

From
Brian Hetro <whee@smaertness.net>
Date
Jul 5, 2008, 05:24 UTC
Message-ID
<fd5cae53021281c920ba48efef82dc8a8d3c7fe1.1215234749.git.whee@smaertness.net>
In-Reply-To
<cover.1215234749.git.whee@smaertness.net>
Signed-off-by: Brian Hetro <whee@smaertness.net>
---
 builtin-commit.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index e3ad38b..745c11e 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -45,7 +45,8 @@ static enum {
 	COMMIT_PARTIAL,
 } commit_style;
 
-static char *logfile, *force_author, *template_file;
+static char *logfile, *force_author;
+static const char *template_file;
 static char *edit_message, *use_message;
 static char *author_name, *author_email, *author_date;
 static int all, edit_flag, also, interactive, only, amend, signoff;
@@ -877,12 +878,8 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 
 int git_commit_config(const char *k, const char *v, void *cb)
 {
-	if (!strcmp(k, "commit.template")) {
-		if (!v)
-			return config_error_nonbool(v);
-		template_file = xstrdup(v);
-		return 0;
-	}
+	if (!strcmp(k, "commit.template"))
+		return git_config_string(&template_file, k, v);
 
 	return git_status_config(k, v, cb);
 }
-- 
1.5.6.1.204.g699135
Previous: Brian HetroNext: Brian Hetro
Message 2 of 7 in “git_config_string janitorial conversions.”
  1. 0/5 git_config_string janitorial conversions.Brian Hetro, Jul 5, 2008
  2. 1/5 builtin-commit.c: Use 'git_config_string' to get 'commit.template'Brian Hetro, Jul 5, 2008
  3. 2/5 builtin-log.c: Use 'git_config_string' to get 'format.subjectprefix' and 'format.suffix'Brian Hetro, Jul 5, 2008
  4. 3/5 convert.c: Use 'git_config_string' to get 'smudge' and 'clean'Brian Hetro, Jul 5, 2008
  5. 4/5 diff.c: Use 'git_config_string' to get 'diff.external'Brian Hetro, Jul 5, 2008
  6. 5/5 http.c: Use 'git_config_string' to clean up SSL config.Brian Hetro, Jul 5, 2008
  7. Christian CouderJul 6, 2008

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.