Skip to content

Commit 8683a45

Browse files
dschoJunio C Hamano
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 171e800 commit 8683a45

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

builtin-init-db.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,11 @@ static void copy_templates(const char *git_dir, int len, const char *template_di
124124
int template_len;
125125
DIR *dir;
126126

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+
}
129132
strcpy(template_path, template_dir);
130133
template_len = strlen(template_path);
131134
if (template_path[template_len-1] != '/') {

t/test-lib.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,9 @@ test_done () {
208208
# t/ subdirectory and are run in trash subdirectory.
209209
PATH=$(pwd)/..:$PATH
210210
GIT_EXEC_PATH=$(pwd)/..
211+
GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
211212
HOME=$(pwd)/trash
212-
export PATH GIT_EXEC_PATH HOME
213+
export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR HOME
213214

214215
GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
215216
export GITPERLLIB

0 commit comments

Comments
 (0)