rev-list-options.txt: fix simple typo
[git/debian.git] / t / t0035-safe-bare-repository.sh
blobecbdc8238db988ee23ea3c66ddbf30fbd3777520
1 #!/bin/sh
3 test_description='verify safe.bareRepository checks'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 pwd="$(pwd)"
10 expect_accepted () {
11 git "$@" rev-parse --git-dir
14 expect_rejected () {
15 test_must_fail git "$@" rev-parse --git-dir 2>err &&
16 grep -F "cannot use bare repository" err
19 test_expect_success 'setup bare repo in worktree' '
20 git init outer-repo &&
21 git init --bare outer-repo/bare-repo
24 test_expect_success 'safe.bareRepository unset' '
25 expect_accepted -C outer-repo/bare-repo
28 test_expect_success 'safe.bareRepository=all' '
29 test_config_global safe.bareRepository all &&
30 expect_accepted -C outer-repo/bare-repo
33 test_expect_success 'safe.bareRepository=explicit' '
34 test_config_global safe.bareRepository explicit &&
35 expect_rejected -C outer-repo/bare-repo
38 test_expect_success 'safe.bareRepository in the repository' '
39 # safe.bareRepository must not be "explicit", otherwise
40 # git config fails with "fatal: not in a git directory" (like
41 # safe.directory)
42 test_config -C outer-repo/bare-repo safe.bareRepository \
43 all &&
44 test_config_global safe.bareRepository explicit &&
45 expect_rejected -C outer-repo/bare-repo
48 test_expect_success 'safe.bareRepository on the command line' '
49 test_config_global safe.bareRepository explicit &&
50 expect_accepted -C outer-repo/bare-repo \
51 -c safe.bareRepository=all
54 test_done