test-lib*.sh: set GIT_CEILING_DIRECTORIES
[topgit/pro.git] / t / t1030-cding-around.sh
blobb75947732cd1032b34e1598f052eb200f3e8d948
1 #!/bin/sh
3 test_description='tg -C used multiple times works properly'
5 TEST_NO_CREATE_REPO=1
7 . ./test-lib.sh
9 GIT_CEILING_DIRECTORIES="$PWD" && export GIT_CEILING_DIRECTORIES
11 test_plan 3
13 test_expect_success 'test setup' '
14 test_create_repo refs &&
15 test_create_repo heads &&
16 git -C refs config topgit.top-bases refs &&
17 git -C heads config topgit.top-bases heads &&
18 test "$(cd refs && git config topgit.top-bases)" = "refs" &&
19 test "$(cd heads && git config topgit.top-bases)" = "heads" &&
20 mkdir sub &&
21 mkdir sub/dir
24 match_str() {
25 test "$1" = "$2"
28 test_expect_success 'tg -C gets to refs' '
29 match_str "refs/top-bases" "$(tg -C refs --top-bases)" &&
30 cd sub &&
31 match_str "refs/top-bases" "$(tg -C dir -C .. -C ../refs --top-bases)"
34 test_expect_success 'tg -C gets to heads' '
35 match_str "refs/heads/{top-bases}" "$(tg -C heads --top-bases)" &&
36 cd sub &&
37 match_str "refs/heads/{top-bases}" "$(tg -C dir -C .. -C ../heads --top-bases)"
40 test_done