Code

Merge branch 'tr/maint-no-index-fixes'
[git.git] / t / t0001-init.sh
index 2a38d98cb46ec5392093dc3c0eedf28d6f56c96b..5ac0a273a94c033fbb7c48cb9a22e44c389e0f7d 100755 (executable)
@@ -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