Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t1515-rev-parse-outside-repo.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t1515-rev-parse-outside-repo.sh` 46 lines ยท 1273 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='check that certain rev-parse options work outside repo' 4 5 . ./test-lib.sh 6 7 test_expect_success 'set up non-repo directory' ' 8 GIT_CEILING_DIRECTORIES=$(pwd) && 9 export GIT_CEILING_DIRECTORIES && 10 mkdir non-repo && 11 cd non-repo && 12 # confirm that git does not find a repo 13 test_must_fail git rev-parse --git-dir 14 ' 15 16 # Rather than directly test the output of sq-quote directly, 17 # make sure the shell can read back a tricky case, since 18 # that's what we really care about anyway. 19 tricky="really tricky with \\ and \" and '" 20 dump_args () { 21 for i in "$@"; do 22 echo "arg: $i" 23 done 24 } 25 test_expect_success 'rev-parse --sq-quote' ' 26 dump_args "$tricky" easy >expect && 27 eval "dump_args $(git rev-parse --sq-quote "$tricky" easy)" >actual && 28 test_cmp expect actual 29 ' 30 31 test_expect_success 'rev-parse --local-env-vars' ' 32 git rev-parse --local-env-vars >actual && 33 # we do not want to depend on the complete list here, 34 # so just look for something plausible 35 test_grep ^GIT_DIR actual 36 ' 37 38 test_expect_success 'rev-parse --resolve-git-dir' ' 39 git init --separate-git-dir repo dir && 40 test_must_fail git rev-parse --resolve-git-dir . && 41 echo "$(pwd)/repo" >expect && 42 git rev-parse --resolve-git-dir dir/.git >actual && 43 test_cmp expect actual 44 ' 45 46 test_done