Include `init.templatedir` as an alias for `init-db.templatedir`. Signed-off-by: Steven Drake <sdrake@xxxxxxxxxx> --- builtin-init-db.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/builtin-init-db.c b/builtin-init-db.c index dd84cae..d56b3a4 100644 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@ -20,6 +20,7 @@ static int init_is_bare_repository = 0; static int init_shared_repository = -1; +static const char *init_db_template_dir; static void safe_create_dir(const char *dir, int share) { @@ -121,6 +122,8 @@ static void copy_templates(const char *template_dir) if (!template_dir) template_dir = getenv(TEMPLATE_DIR_ENVIRONMENT); if (!template_dir) + template_dir = init_db_template_dir; + if (!template_dir) template_dir = system_path(DEFAULT_GIT_TEMPLATE_DIR); if (!template_dir[0]) return; @@ -165,6 +168,15 @@ static void copy_templates(const char *template_dir) closedir(dir); } +static int git_init_db_config(const char *k, const char *v, void *cb) +{ + /* we will accept "init-db.templatedir" or "init.templatedir" */ + if (!strcmp(k, "init-db.templatedir") || !strcmp(k, "init.templatedir")) + return git_config_pathname(&init_db_template_dir, k, v); + + return 0; +} + static int create_default_files(const char *template_path) { const char *git_dir = get_git_dir(); @@ -190,6 +202,9 @@ static int create_default_files(const char *template_path) safe_create_dir(git_path("refs/heads"), 1); safe_create_dir(git_path("refs/tags"), 1); + /* Just look for `init-db.templatedir` */ + git_config(git_init_db_config, NULL); + /* First copy the templates -- we might have the default * config file there, in which case we would want to read * from it after installing. -- 1.6.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html