Introduce GIT_TEMPLATE_DIR
Instead of passing --template explicitely to init-db and clone, you can just set the environment variable GIT_TEMPLATE_DIR. Also make use of it in the tests, to make sure that the templates are copied. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Johannes Schindelin committed
Dec 19, 2006 at 09:18 UTC
8683a45d66967b0969516a2b72cdbf136c2064a2
2 files changed
+7
-3
builtin-init-db.c
+5
-2
@@ -124,8 +124,11 @@ static void copy_templates(const char *git_dir, int len, const char *template_di
124
int template_len;
125
DIR *dir;
126
127
- if (!template_dir)
128
- template_dir = DEFAULT_GIT_TEMPLATE_DIR;
127
+ if (!template_dir) {
128
+ template_dir = getenv("GIT_TEMPLATE_DIR");
129
+ if (!template_dir)
130
+ template_dir = DEFAULT_GIT_TEMPLATE_DIR;
131
+ }
132
strcpy(template_path, template_dir);
133
template_len = strlen(template_path);
134
if (template_path[template_len-1] != '/') {
t/test-lib.sh
+2
-1
@@ -208,8 +208,9 @@ test_done () {
208
# t/ subdirectory and are run in trash subdirectory.
209
PATH=$(pwd)/..:$PATH
210
GIT_EXEC_PATH=$(pwd)/..
211
+GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
212
HOME=$(pwd)/trash
212
-export PATH GIT_EXEC_PATH HOME
213
+export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR HOME
214
215
GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
216
export GITPERLLIB