3 test_description='server update ensure follows'
7 test_expect_success 'setup' '
10 git commit -m "setup" &&
11 git clone ./. server &&
12 rm -fr server/.git/hooks &&
13 git remote add origin ./server &&
14 git config --add branch.master.remote origin &&
15 git config --add branch.master.merge refs/heads/master &&
19 install_update_hook 'update-ensure-follows'
21 test_expect_success 'pushing stable works' '
22 git checkout -b stable &&
23 git push origin stable
26 test_expect_success 'branch with unmoved stable is okay' '
28 git config hooks.update-ensure-follows.branches stable &&
31 git checkout -b topic1 &&
32 echo "$test_name" >a.topic1 &&
34 git commit -m "Add on topic1." &&
35 git push origin topic1
38 test_expect_success 'branch with moved stable requires merge' '
39 git checkout stable &&
40 echo "$test_name" >a &&
41 git commit -a -m "Change on stable" &&
42 git push origin stable &&
44 git checkout topic1 &&
45 echo "$test_name" >a.topic1 &&
46 git commit -a -m "Change on topic1." &&
47 ! git push origin topic1 2>push.err &&
48 cat push.err | grep "You need to merge stable into topic1" &&
51 git push origin topic1
54 test_expect_success 'branch with moved stable as second branch requires merge' '
56 git config hooks.update-ensure-follows.branches "foo stable" &&
59 git checkout stable &&
60 echo "$test_name" >a &&
61 git commit -a -m "Change on stable" &&
62 git push origin stable &&
64 git checkout topic1 &&
65 echo "$test_name" >a.topic1 &&
66 git commit -a -m "Change on topic1." &&
67 ! git push origin topic1 2>push.err &&
68 cat push.err | grep "You need to merge stable into topic1" &&
71 git push origin topic1
74 test_expect_success 'tag with moved stable is okay' '
75 git checkout stable &&
76 echo "$test_name" >a &&
77 git commit -a -m "Change on stable" &&
78 git push origin stable &&
80 git checkout topic1 &&
85 test_expect_success 'branch deletion with moved stable is okay' '
86 git checkout stable &&
87 echo "$test_name" >a &&
88 git commit -a -m "Change on stable" &&
90 git push origin :topic1
93 test_expect_success 'excused branch with moved stable is okay' '
94 git checkout -b topic2 stable &&
95 echo "$test_name" >a.topic2 &&
97 git commit -m "Change on topic2" &&
98 git push origin topic2 &&
100 git checkout stable &&
101 echo "$test_name" >a &&
102 git commit -a -m "Change on stable" &&
103 git push origin stable &&
105 git checkout topic2 &&
106 echo "$test_name foo" >a.topic2 &&
107 git commit -a -m "Change on topic2 again" &&
108 ! git push origin topic2 &&
111 git config hooks.update-ensure-follows.excused topic2 &&
114 git push origin topic2