@matheusbsbs / matheus-bagliano / commits / a94d305bf8
Fork 0

t/t0001-init.sh: add test for 'init with init.templatedir set'

Requires a small change to wrap-for-bin.sh in order to work. Signed-off-by: Steven Drake <sdrake@xnet.co.nz> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Steven Drake committed Feb 26, 2010 at 17:00 UTC a94d305bf8043a7a0579037c7e52e632613410f7
2 files changed +21 -1
t/t0001-init.sh
+19
@@ -167,6 +167,25 @@ test_expect_success 'init with --template (blank)' '
167 ! test -f template-blank/.git/info/exclude
168 '
169
170 +test_expect_success 'init with init.templatedir set' '
171 + mkdir templatedir-source &&
172 + echo Content >templatedir-source/file &&
173 + (
174 + HOME="`pwd`" &&
175 + export HOME &&
176 + test_config="${HOME}/.gitconfig" &&
177 + git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" &&
178 + mkdir templatedir-set &&
179 + cd templatedir-set &&
180 + unset GIT_CONFIG_NOGLOBAL &&
181 + unset GIT_TEMPLATE_DIR &&
182 + NO_SET_GIT_TEMPLATE_DIR=t &&
183 + export NO_SET_GIT_TEMPLATE_DIR &&
184 + git init
185 + ) &&
186 + test_cmp templatedir-source/file templatedir-set/.git/file
187 +'
188 +
189 test_expect_success 'init --bare/--shared overrides system/global config' '
190 (
191 HOME="`pwd`" &&
wrap-for-bin.sh
+2 -1
@@ -7,7 +7,8 @@
7 # @@BUILD_DIR@@ and @@PROG@@.
8
9 GIT_EXEC_PATH='@@BUILD_DIR@@'
10 -GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
10 +test -z "$NO_SET_GIT_TEMPLATE_DIR" &&
11 + GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
12 GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'
13 PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
14 export GIT_EXEC_PATH GIT_TEMPLATE_DIR GITPERLLIB PATH