README_DOCS.rst: update tg prev and tg next usage summary
[topgit/pro.git] / t / t2010-hook-checks.sh
blobf62a85eb71fa37a2987ec99259f4aab338ecb2e2
1 #!/bin/sh
3 test_description='verify hook restrictions are working'
5 . ./test-lib.sh
7 test_plan 13
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 &&
14 test_commit base &&
15 git branch master2 &&
16 tg_test_create_branch tgb1 master &&
17 tg_test_create_branch tgb2 tgb1 &&
18 test_tick && test_when_finished test_tick=$test_tick &&
19 git checkout tgb1
22 test_expect_success '.topdeps required' '
23 git reset --hard &&
24 git rm .topdeps &&
25 test_must_fail git commit -m "remove .topdeps"
28 test_expect_success '.topmsg required' '
29 git reset --hard &&
30 git rm .topmsg &&
31 test_must_fail git commit -m "remove .topmsg"
34 test_expect_success '.topdeps & .topmsg required' '
35 git reset --hard &&
36 git rm .topdeps .topmsg &&
37 test_must_fail git commit -m "remove .topdeps & .topmsg"
40 test_expect_success 'unknown .topdeps branch forbidden' '
41 git reset --hard &&
42 echo foo >> .topdeps &&
43 git add .topdeps &&
44 test_must_fail git commit -m "add unknown branch"
47 test_expect_success 'unknown .topdeps branch w/o nl forbidden' '
48 git reset --hard &&
49 printf "%s" foo >> .topdeps &&
50 git add .topdeps &&
51 test_must_fail git commit -m "add unknown branch"
54 test_expect_success 'duplicate .topdeps branch forbidden' '
55 git reset --hard &&
56 echo master >> .topdeps &&
57 git add .topdeps &&
58 test_must_fail git commit -m "add duplicate branch"
61 test_expect_success 'duplicate .topdeps branch w/o nl forbidden' '
62 git reset --hard &&
63 printf "%s" master >> .topdeps &&
64 git add .topdeps &&
65 test_must_fail git commit -m "add duplicate branch"
68 test_expect_success 'looping .topdeps branch forbidden' '
69 git reset --hard &&
70 echo tgb2 >> .topdeps &&
71 git add .topdeps &&
72 test_must_fail git commit -m "add looping branch"
75 test_expect_success 'looping .topdeps branch w/o nl forbidden' '
76 git reset --hard &&
77 printf "%s" tgb2 >> .topdeps &&
78 git add .topdeps &&
79 test_must_fail git commit -m "add looping branch"
82 test_expect_success 'existing branch .topdeps addition okay' '
83 git reset --hard &&
84 echo master2 >> .topdeps &&
85 git add .topdeps &&
86 git commit -m "add known branch"
89 test_expect_success '.topdeps can be empty' '
90 git reset --hard &&
91 rm -f .topdeps &&
92 touch .topdeps &&
93 git add .topdeps &&
94 git commit -m "empty out .topdeps"
97 test_expect_success '.topmsg cannot be empty' '
98 git reset --hard &&
99 rm -f .topmsg &&
100 touch .topmsg &&
101 git add .topmsg &&
102 test_must_fail git commit -m "empty out .topmsg"
105 test_done