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 &&
19 echo cbas >./server/.git/description
22 install_server_hook 'post-receive-email' 'post-receive'
24 test_expect_success 'create tag' '
25 git tag -a -m 1.0 1.0 &&
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) &&
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
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) &&
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) &&
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
53 test_expect_success 'retag branch' '
54 git tag -a -m 2.0 2.0 &&
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) &&
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