Tweak the email format.
[git-central.git] / tests / t2201-server-post-receive-email-tags.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 tag' '
25         git tag -a -m 1.0 1.0 &&
26         git push --tags &&
27         new_commit_hash=$(git rev-parse HEAD) &&
28         tag_hash=$(git rev-parse 1.0) &&
29         eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/1.0) &&
30
31         interpolate ../t2201-1.txt 1.txt new_commit_hash tag_hash tag_date &&
32         test_cmp 1.txt server/.git/refs.tags.1.0.out
33 '
34
35 test_expect_success 'commit on tag branch' '
36         old_commit_hash=$(git rev-parse HEAD) &&
37         echo "$test_name" >a &&
38         git commit -a -m "$test_name" &&
39         prior_commit_hash=$(git rev-parse HEAD) &&
40         prior_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
41
42         echo "$test_name 2" >a &&
43         git commit -a -m "$test_name 2" &&
44         new_commit_hash=$(git rev-parse HEAD) &&
45         new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
46
47         git push &&
48         new_commit_abbrev=$(git rev-list -n 1 --pretty=format:%h HEAD | grep -v commit) &&
49         interpolate ../t2201-2.txt 2.txt old_commit_hash new_commit_hash new_commit_date new_commit_abbrev prior_commit_hash prior_commit_date &&
50         test_cmp 2.txt server/.git/refs.heads.master.out
51 '
52
53 test_expect_success 'retag branch' '
54         git tag -a -m 2.0 2.0 &&
55         git push --tags &&
56         new_commit_hash=$(git rev-parse HEAD) &&
57         tag_hash=$(git rev-parse 2.0) &&
58         eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
59
60         interpolate ../t2201-3.txt 3.txt new_commit_hash tag_hash tag_date &&
61         test_cmp 3.txt server/.git/refs.tags.2.0.out
62 '
63
64 test_done
65