builtin-commit.c: Use 'git_config_string' to get 'commit.template'
authorBrian Hetro <whee@smaertness.net>
Sat, 5 Jul 2008 05:24:40 +0000 (01:24 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sun, 6 Jul 2008 00:42:54 +0000 (17:42 -0700)
Signed-off-by: Brian Hetro <whee@smaertness.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-commit.c

index 90200ed643bcf21f28a66396f0d15db920a5d4c8..bcbea3893b6ddb40388f5a5ab49b022af5a88df1 100644 (file)
@@ -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;
@@ -864,12 +865,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);
 }