3 test_description='server post-receive email notification'
7 test_expect_success 'setup' '
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 &&
21 install_server_hook 'post-receive-email' 'post-receive'
23 test_expect_success 'create tag' '
24 git tag -a -m 1.0 1.0 &&
26 new_commit_hash=$(git rev-parse HEAD) &&
27 tag_hash=$(git rev-parse 1.0) &&
28 eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/1.0) &&
30 interpolate ../t2201-1.txt 1.txt new_commit_hash tag_hash tag_date &&
31 test_cmp 1.txt server/.git/refs.tags.1.0.out
34 test_expect_success 'commit on tag branch' '
35 old_commit_hash=$(git rev-parse HEAD) &&
36 echo "$test_name" >a &&
37 git commit -a -m "$test_name" &&
38 prior_commit_hash=$(git rev-parse HEAD) &&
39 prior_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
41 echo "$test_name 2" >a &&
42 git commit -a -m "$test_name 2" &&
43 new_commit_hash=$(git rev-parse HEAD) &&
44 new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
47 new_commit_abbrev=$(git rev-list -n 1 --pretty=format:%h HEAD | grep -v commit) &&
48 interpolate ../t2201-2.txt 2.txt old_commit_hash new_commit_hash new_commit_date new_commit_abbrev prior_commit_hash prior_commit_date &&
49 test_cmp 2.txt server/.git/refs.heads.master.out
52 test_expect_success 'retag branch' '
53 git tag -a -m 2.0 2.0 &&
55 new_commit_hash=$(git rev-parse HEAD) &&
56 tag_hash=$(git rev-parse 2.0) &&
57 eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
59 interpolate ../t2201-3.txt 3.txt new_commit_hash tag_hash tag_date &&
60 test_cmp 3.txt server/.git/refs.tags.2.0.out