git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
SDSteven Drake <sdrake@xnet.co.nz>
Date
Feb 26, 2010, 04:00 UTC
Message-ID
<7bce5804fd71ac19c9164c9c2deb9dd714dc7aee.1267156694.git.sdrake@xnet.co.nz>
In-Reply-To
<c28821e9079f35e7267a1e7381ccf7793c12bf24.1267156694.git.sdrake@xnet.co.nz>
Requires a small change to wrap-for-bin.sh in order to work.
Signed-off-by: Steven Drake <sdrake@xnet.co.nz>
---
 t/t0001-init.sh |   19 +++++++++++++++++++
 wrap-for-bin.sh |    3 ++-
 2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 5386504..6757734 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -167,6 +167,25 @@ test_expect_success 'init with --template (blank)' '
 	! test -f template-blank/.git/info/exclude
 '
 
+test_expect_success 'init with init.templatedir set' '
+	mkdir templatedir-source &&
+	echo Content >templatedir-source/file &&
+	(
+		HOME="`pwd`" &&
+		export HOME &&
+		test_config="${HOME}/.gitconfig" &&
+		git config -f "$test_config"  init.templatedir "${HOME}/templatedir-source" &&
+		mkdir templatedir-set &&
+		cd templatedir-set &&
+		unset GIT_CONFIG_NOGLOBAL &&
+		unset GIT_TEMPLATE_DIR &&
+		NO_SET_GIT_TEMPLATE_DIR=t &&
+		export NO_SET_GIT_TEMPLATE_DIR &&
+		git init
+	) &&
+	test_cmp templatedir-source/file templatedir-set/.git/file
+'
+
 test_expect_success 'init --bare/--shared overrides system/global config' '
 	(
 		HOME="`pwd`" &&
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index c5075c9..aece782 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -7,7 +7,8 @@
 # @@BUILD_DIR@@ and @@PROG@@.
 
 GIT_EXEC_PATH='@@BUILD_DIR@@'
-GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+test -z "$NO_SET_GIT_TEMPLATE_DIR" &&
+	GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
 GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'
 PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
 export GIT_EXEC_PATH GIT_TEMPLATE_DIR GITPERLLIB PATH
-- 
1.6.6
Previous: Steven DrakeNext: Junio C Hamano
Message 2 of 7 in “Having keywords without value is not a global error.”
  1. Having keywords without value is not a global error.Steven Drake, Feb 26, 2010
  2. t/t0001-init.sh: add test for 'init with init.templatedir set'Steven Drake, Feb 26, 2010
  3. Junio C HamanoFeb 26, 2010
  4. Steven DrakeFeb 26, 2010
  5. Junio C HamanoFeb 26, 2010
  6. Alex RiesenFeb 26, 2010
  7. Steven DrakeFeb 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.