More email tests.
[git-central.git] / tests / t2200-server-post-receive-email.sh
1 #!/bin/sh
2
3 test_description='server post-receive email notification'
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 ./. 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 &&
16         GIT_DIR=./server/.git git config --add hooks.mailinglist commits@list.com &&
17         GIT_DIR=./server/.git git config --add hooks.debug true &&
18         GIT_DIR=.
19 '
20
21 install_server_hook 'post-receive-email' 'post-receive'
22
23 test_expect_success 'simple commit' '
24         echo $test_name >a &&
25         git commit -a -m "$test_name" &&
26         git push &&
27         old_commit_hash=$(git rev-parse HEAD^) &&
28         new_commit_hash=$(git rev-parse HEAD) &&
29         new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
30         interpolate ../t2200-1.txt 1.txt old_commit_hash new_commit_hash new_commit_date &&
31         test_cmp 1.txt server/.git/refs.heads.master.out
32 '
33
34 test_done
35