X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=t%2Ft0001-init.sh;h=7c0a698b92696ff2bbb91e65e0a42e87f9163a1d;hb=452c6d506b1a6dcf24d4ceaa592afc39c1c1a60e;hp=5386504790deea55d127f053f7b714cd121a2d57;hpb=b0e67fffb42059cc5dca6f58c376a2ffc5fb4520;p=git.git diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 538650479..7c0a698b9 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`" && @@ -291,4 +310,18 @@ test_expect_success POSIXPERM 'init notices EPERM' ' ) ' +test_expect_success 'init creates a new bare directory with global --bare' ' + rm -rf newdir && + git --bare init newdir && + test -d newdir/refs +' + +test_expect_success 'init prefers command line to GIT_DIR' ' + rm -rf newdir && + mkdir otherdir && + GIT_DIR=otherdir git --bare init newdir && + test -d newdir/refs && + ! test -d otherdir/refs +' + test_done