3 test_description
='check that certain rev-parse options work outside repo'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'set up non-repo directory' '
9 GIT_CEILING_DIRECTORIES=$(pwd) &&
10 export GIT_CEILING_DIRECTORIES &&
13 # confirm that git does not find a repo
14 test_must_fail git rev-parse --git-dir
17 # Rather than directly test the output of sq-quote directly,
18 # make sure the shell can read back a tricky case, since
19 # that's what we really care about anyway.
20 tricky
="really tricky with \\ and \" and '"
26 test_expect_success
'rev-parse --sq-quote' '
27 dump_args "$tricky" easy >expect &&
28 eval "dump_args $(git rev-parse --sq-quote "$tricky" easy)" >actual &&
29 test_cmp expect actual
32 test_expect_success
'rev-parse --local-env-vars' '
33 git rev-parse --local-env-vars >actual &&
34 # we do not want to depend on the complete list here,
35 # so just look for something plausible
39 test_expect_success
'rev-parse --resolve-git-dir' '
40 git init --separate-git-dir repo dir &&
41 test_must_fail git rev-parse --resolve-git-dir . &&
42 echo "$(pwd)/repo" >expect &&
43 git rev-parse --resolve-git-dir dir/.git >actual &&
44 test_cmp expect actual