3 test_description
='verify hook restrictions are working'
9 # makes sure tg_test_setup_topgit will work on non-bin-wrappers testees
10 PATH
="${TG_TEST_FULL_PATH%/*}:$PATH" && export PATH
12 test_expect_success
'setup' '
13 tg_test_setup_topgit &&
16 tg_test_create_branch tgb1 master &&
17 tg_test_create_branch tgb2 tgb1 &&
18 test_tick && test_when_finished test_tick=$test_tick &&
22 test_expect_success
'.topdeps required' '
25 test_must_fail git commit -m "remove .topdeps"
28 test_expect_success
'.topmsg required' '
31 test_must_fail git commit -m "remove .topmsg"
34 test_expect_success
'.topdeps & .topmsg required' '
36 git rm .topdeps .topmsg &&
37 test_must_fail git commit -m "remove .topdeps & .topmsg"
40 test_expect_success
'unknown .topdeps branch forbidden' '
42 echo foo >> .topdeps &&
44 test_must_fail git commit -m "add unknown branch"
47 test_expect_success
'unknown .topdeps branch w/o nl forbidden' '
49 printf "%s" foo >> .topdeps &&
51 test_must_fail git commit -m "add unknown branch"
54 test_expect_success
'duplicate .topdeps branch forbidden' '
56 echo master >> .topdeps &&
58 test_must_fail git commit -m "add duplicate branch"
61 test_expect_success
'duplicate .topdeps branch w/o nl forbidden' '
63 printf "%s" master >> .topdeps &&
65 test_must_fail git commit -m "add duplicate branch"
68 test_expect_success
'looping .topdeps branch forbidden' '
70 echo tgb2 >> .topdeps &&
72 test_must_fail git commit -m "add looping branch"
75 test_expect_success
'looping .topdeps branch w/o nl forbidden' '
77 printf "%s" tgb2 >> .topdeps &&
79 test_must_fail git commit -m "add looping branch"
82 test_expect_success
'existing branch .topdeps addition okay' '
84 echo master2 >> .topdeps &&
86 git commit -m "add known branch"
89 test_expect_success
'.topdeps can be empty' '
94 git commit -m "empty out .topdeps"
97 test_expect_success
'.topmsg cannot be empty' '
102 test_must_fail git commit -m "empty out .topmsg"