Skip to content

Commit

Permalink
Introduce GIT_TEMPLATE_DIR
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Dec 19, 2006
1 parent 171e800 commit 8683a45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions builtin-init-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,11 @@ static void copy_templates(const char *git_dir, int len, const char *template_di
int template_len;
DIR *dir;

if (!template_dir)
template_dir = DEFAULT_GIT_TEMPLATE_DIR;
if (!template_dir) {
template_dir = getenv("GIT_TEMPLATE_DIR");
if (!template_dir)
template_dir = DEFAULT_GIT_TEMPLATE_DIR;
}
strcpy(template_path, template_dir);
template_len = strlen(template_path);
if (template_path[template_len-1] != '/') {
Expand Down
3 changes: 2 additions & 1 deletion t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ test_done () {
# t/ subdirectory and are run in trash subdirectory.
PATH=$(pwd)/..:$PATH
GIT_EXEC_PATH=$(pwd)/..
GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
HOME=$(pwd)/trash
export PATH GIT_EXEC_PATH HOME
export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR HOME

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

0 comments on commit 8683a45

Please sign in to comment.