Tweak the email format.
[git-central.git] / tests / t2202-server-post-receive-email-branches.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         echo cbas >./server/.git/description
20 '
21
22 install_server_hook 'post-receive-email' 'post-receive'
23
24 test_expect_success 'create branch' '
25         git checkout -b topic master &&
26         echo "$test_name" >a &&
27         git commit -a -m "$test_name on topic" &&
28         prior_commit_hash=$(git rev-parse HEAD) &&
29         prior_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
30
31         echo "$test_name 2" >a &&
32         git commit -a -m "$test_name on topic 2 " &&
33         new_commit_hash=$(git rev-parse HEAD) &&
34         new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
35
36         git push origin topic &&
37
38         interpolate ../t2202-1.txt 1.txt new_commit_hash new_commit_date prior_commit_hash prior_commit_date &&
39         test_cmp 1.txt server/.git/refs.heads.topic.out
40 '
41
42 test_expect_success 'delete branch' '
43         old_commit_hash=$(git rev-parse HEAD) &&
44         git push origin :refs/heads/topic &&
45
46         interpolate ../t2202-2.txt 2.txt old_commit_hash &&
47         test_cmp 2.txt server/.git/refs.heads.topic.out
48 '
49
50 test_done
51