28733dbcbabda9392ac6977dd3510d7854aa4816
[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 export USER_EMAIL=author@example.com
8
9 test_expect_success 'setup' '
10         echo "setup" >a &&
11         git add a &&
12         git commit -m "setup" &&
13         git clone ./. server &&
14         rm -fr server/.git/hooks &&
15         git remote add origin ./server &&
16         git config branch.master.remote origin &&
17         git config branch.master.merge refs/heads/master &&
18         GIT_DIR=./server/.git git config hooks.post-receive-email.mailinglist commits@list.com &&
19         GIT_DIR=./server/.git git config hooks.post-receive-email.debug true &&
20         echo cbas >./server/.git/description
21 '
22
23 install_post_receive_hook 'post-receive-email'
24
25 test_expect_success 'simple commit' '
26         old_commit_hash=$(git rev-parse HEAD) &&
27         old_commit_abbrev=$(git rev-parse --short HEAD) &&
28
29         echo $test_name >a &&
30         git commit -a -m "$test_name" &&
31         git push &&
32         new_commit_hash=$(git rev-parse HEAD) &&
33         new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
34         new_commit_abbrev=$(git rev-parse --short HEAD) &&
35
36         interpolate ../t2200-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_date new_commit_abbrev &&
37         test_cmp 1.txt server/.git/refs.heads.master.out
38 '
39
40 test_done
41