tg.sh: handle help -h
[topgit/pro.git] / t / t1030-cding-around.sh
blobb1c81ef0cc5ff2293bd4d81c0e8b05e80824dc53
1 #!/bin/sh
3 test_description='tg -C used multiple times works properly'
5 TEST_NO_CREATE_REPO=1
7 . ./test-lib.sh
9 test_plan 3
11 test_expect_success 'test setup' '
12 test_create_repo refs &&
13 test_create_repo heads &&
14 git -C refs config topgit.top-bases refs &&
15 git -C heads config topgit.top-bases heads &&
16 test "$(cd refs && git config topgit.top-bases)" = "refs" &&
17 test "$(cd heads && git config topgit.top-bases)" = "heads" &&
18 mkdir sub &&
19 mkdir sub/dir
22 match_str() {
23 test "$1" = "$2"
26 test_expect_success 'tg -C gets to refs' '
27 match_str "refs/top-bases" "$(tg -C refs --top-bases)" &&
28 cd sub &&
29 match_str "refs/top-bases" "$(tg -C dir -C .. -C ../refs --top-bases)"
32 test_expect_success 'tg -C gets to heads' '
33 match_str "refs/heads/{top-bases}" "$(tg -C heads --top-bases)" &&
34 cd sub &&
35 match_str "refs/heads/{top-bases}" "$(tg -C dir -C .. -C ../heads --top-bases)"
38 test_done