3 test_description
='verify hook sequestration works properly'
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 &&
21 tg_test_create_branch tgb1 master &&
22 tg_test_create_branch tgb2 tgb1 &&
23 test_tick && test_when_finished test_tick=$test_tick &&
28 git rev-list
--count --first-parent HEAD
--
31 test_expect_success
'.topdeps only does not sequester' '
33 cnt1="$(count_commits)" &&
34 echo master2 >> .topdeps &&
36 git commit -m "modify .topdeps" &&
37 cnt2="$(count_commits)" &&
38 test $(( $cnt1 + 1 )) -eq $cnt2
41 test_expect_success
'.topmsg only does not sequester' '
43 cnt1="$(count_commits)" &&
44 echo "do dah do dah do dah doo" >> .topmsg &&
46 git commit -m "modify .topmsg" &&
47 cnt2="$(count_commits)" &&
48 test $(( $cnt1 + 1 )) -eq $cnt2
51 test_expect_success
'.topdeps & .topmsg only does not sequester' '
53 cnt1="$(count_commits)" &&
54 echo master3 >> .topdeps &&
56 echo "doo dah doo do dah doo" >> .topmsg &&
58 git commit -m "modify .topdeps & .topmsg" &&
59 cnt2="$(count_commits)" &&
60 test $(( $cnt1 + 1 )) -eq $cnt2
63 test_expect_success
'non .top* commit does not sequester' '
65 cnt1="$(count_commits)" &&
67 cnt2="$(count_commits)" &&
68 test $(( $cnt1 + 1 )) -eq $cnt2
71 test_expect_success
'.topdeps and other sequesters' '
73 cnt1="$(count_commits)" &&
74 echo master4 >> .topdeps &&
76 echo other1 > other1 &&
78 test_must_fail git commit -m "modify .topdeps and add other1" &&
79 cnt2="$(count_commits)" &&
80 test $(( $cnt1 + 1 )) -eq $cnt2 &&
81 git commit -m "just add other1" &&
82 cnt3="$(count_commits)" &&
83 test $(( $cnt1 + 2 )) -eq $cnt3
86 test_expect_success
'.topmsg and other sequesters' '
88 git config --bool topgit.sequester true &&
89 cnt1="$(count_commits)" &&
90 echo "do dah do dah do dah do dah doo" >> .topmsg &&
92 echo other2 > other2 &&
94 test_must_fail git commit -m "modify .topdeps and add other2" &&
95 cnt2="$(count_commits)" &&
96 test $(( $cnt1 + 1 )) -eq $cnt2 &&
97 git commit -m "just add other2" &&
98 cnt3="$(count_commits)" &&
99 test $(( $cnt1 + 2 )) -eq $cnt3
102 test_expect_success
'.topdeps and .topmsg and other sequesters' '
104 cnt1="$(count_commits)" &&
105 echo master5 >> .topdeps &&
107 echo "do dah do dah do dah doo" >> .topmsg &&
109 echo other3 > other3 &&
111 test_must_fail git commit -m "modify .topdeps and add other3" &&
112 cnt2="$(count_commits)" &&
113 test $(( $cnt1 + 1 )) -eq $cnt2 &&
114 git commit -m "just add other3" &&
115 cnt3="$(count_commits)" &&
116 test $(( $cnt1 + 2 )) -eq $cnt3
119 test_expect_success
'.topdeps and other sequester bypass' '
121 git config --bool topgit.sequester false &&
122 cnt1="$(count_commits)" &&
123 echo master6 >> .topdeps &&
125 echo other4 > other4 &&
127 git commit -m "modify .topdeps and add other4" &&
128 cnt2="$(count_commits)" &&
129 test $(( $cnt1 + 1 )) -eq $cnt2
132 test_expect_success
'.topmsg and other sequester bypass' '
134 cnt1="$(count_commits)" &&
135 echo "doo dah doo do dah doo" >> .topmsg &&
137 echo other5 > other5 &&
139 git commit -m "modify .topmsg and add other5" &&
140 cnt2="$(count_commits)" &&
141 test $(( $cnt1 + 1 )) -eq $cnt2
144 test_expect_success
'.topdeps and .topmsg and other sequester bypass' '
146 cnt1="$(count_commits)" &&
147 echo master7 >> .topdeps &&
149 echo "do dah do dah do dah do dah doo" >> .topmsg &&
151 echo other6 > other6 &&
153 git commit -m "modify .topdeps and .topmsg and add other6" &&
154 cnt2="$(count_commits)" &&
155 test $(( $cnt1 + 1 )) -eq $cnt2