X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft0001-init.sh;h=5ac0a273a94c033fbb7c48cb9a22e44c389e0f7d;hb=2075ffb58e3a2d46d9e7606010f7f943f2295376;hp=d31887f9bf35a7fa9e31b1eb859a9cf21c918d6c;hpb=bc9c3e0b932c5e14de749e07f5045197e7d6cd76;p=git.git diff --git a/t/t0001-init.sh b/t/t0001-init.sh index d31887f9b..5ac0a273a 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -83,11 +83,11 @@ test_expect_success 'init --bare' ' ( unset GIT_DIR GIT_WORK_TREE GIT_CONFIG - mkdir git-init-bare.git && - cd git-init-bare.git && + mkdir init-bare.git && + cd init-bare.git && git init --bare ) && - check_config git-init-bare.git true unset + check_config init-bare.git true unset ' test_expect_success 'GIT_DIR non-bare' ' @@ -141,4 +141,62 @@ test_expect_success 'reinit' ' test_cmp again/empty again/err2 ' +test_expect_success 'init with --template' ' + mkdir template-source && + echo content >template-source/file && + ( + mkdir template-custom && + cd template-custom && + git init --template=../template-source + ) && + test_cmp template-source/file template-custom/.git/file +' + +test_expect_success 'init with --template (blank)' ' + ( + mkdir template-plain && + cd template-plain && + git init + ) && + test -f template-plain/.git/info/exclude && + ( + mkdir template-blank && + cd template-blank && + git init --template= + ) && + ! test -f template-blank/.git/info/exclude +' + +test_expect_success 'init --bare/--shared overrides system/global config' ' + ( + HOME="`pwd`" && + export HOME && + test_config="$HOME"/.gitconfig && + unset GIT_CONFIG_NOGLOBAL && + git config -f "$test_config" core.bare false && + git config -f "$test_config" core.sharedRepository 0640 && + mkdir init-bare-shared-override && + cd init-bare-shared-override && + git init --bare --shared=0666 + ) && + check_config init-bare-shared-override true unset && + test x0666 = \ + x`git config -f init-bare-shared-override/config core.sharedRepository` +' + +test_expect_success 'init honors global core.sharedRepository' ' + ( + HOME="`pwd`" && + export HOME && + test_config="$HOME"/.gitconfig && + unset GIT_CONFIG_NOGLOBAL && + git config -f "$test_config" core.sharedRepository 0666 && + mkdir shared-honor-global && + cd shared-honor-global && + git init + ) && + test x0666 = \ + x`git config -f shared-honor-global/.git/config core.sharedRepository` +' + test_done