Get tests passing again.
[git-central.git] / tests / t2801-post-receive-gitconfig-hooks.sh
1 #!/bin/bash
2
3 test_description='server update git config'
4
5 . ./test-lib.sh
6
7 test_expect_success 'setup' '
8         echo "setup" >a &&
9         git add a &&
10         git commit -m "setup" &&
11         git clone -l . --bare server.git &&
12         rm -fr server.git/hooks &&
13         git remote add origin ./server.git
14 '
15
16 install_post_receive_hook 'post-receive-gitconfig'
17
18 test_expect_success 'adding hook' '
19         ls server.git/hooks | grep post-receive &&
20         ../../scripts/create-gitconfig &&
21         git checkout gitconfig &&
22
23         mkdir hooks &&
24         cd hooks &&
25         echo "#!/bin/bash" > post-receive &&
26         echo "../../../server/post-receive-gitconfig" >> post-receive &&
27         echo "echo barbar" >> post-receive &&
28         echo "#!/bin/bash" > update  &&
29         echo "echo foofoo" >> update &&
30         git add post-receive &&
31         git add update &&
32         git commit -m "added post-receive and update" &&
33         git push origin gitconfig &&
34         cd .. &&
35
36         cat server.git/hooks/post-receive | grep barbar &&
37         cat server.git/hooks/update | grep foofoo
38 '
39
40 test_expect_success 'changing hook' '
41         echo "#!/bin/bash" > hooks/update  &&
42         echo "echo lala" >> hooks/update &&
43         git commit -a -m "changed update" &&
44         git push origin gitconfig &&
45
46         cat server.git/hooks/post-receive | grep barbar &&
47         ! cat server.git/hooks/update | grep barbar &&
48         cat server.git/hooks/update | grep lala
49 '
50
51 test_expect_success 'removing hook does not work' '
52         git rm hooks/update &&
53         git commit -m "removed update" &&
54         git push origin gitconfig &&
55
56         ls server.git/hooks | grep post-receive
57         ls server.git/hooks | grep update
58 '
59
60 test_done
61