3 test_description='server post-receive email notification'
9 test_expect_success 'setup' '
12 git commit -m "setup" &&
13 git clone ./. server &&
14 rm -fr server/.git/hooks &&
15 git remote add origin ./server &&
16 git config --add branch.master.remote origin &&
17 git config --add branch.master.merge refs/heads/master &&
18 GIT_DIR=./server/.git git config --add hooks.post-receive-email.mailinglist commits@list.com &&
19 GIT_DIR=./server/.git git config --add hooks.post-receive-email.debug true &&
21 echo cbas >./server/.git/description
24 install_post_receive_hook 'post-receive-email'
26 test_expect_success 'create tag' '
27 git tag -a -m 1.0 1.0 &&
29 new_commit_hash=$(git rev-parse HEAD) &&
30 tag_hash=$(git rev-parse 1.0) &&
31 eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/1.0) &&
33 interpolate ../t2201-1.txt 1.txt new_commit_hash tag_hash tag_date &&
34 test_cmp 1.txt server/.git/refs.tags.1.0.out
37 test_expect_success 'commit on tag branch' '
38 old_commit_hash=$(git rev-parse HEAD) &&
39 echo "$test_name" >a &&
40 git commit -a -m "$test_name" &&
41 prior_commit_hash=$(git rev-parse HEAD) &&
42 prior_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
44 echo "$test_name 2" >a &&
45 git commit -a -m "$test_name 2" &&
46 new_commit_hash=$(git rev-parse HEAD) &&
47 new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
50 new_commit_abbrev=$(git rev-list -n 1 --pretty=format:%h HEAD | grep -v commit) &&
51 interpolate ../t2201-2.txt 2.txt old_commit_hash new_commit_hash new_commit_date new_commit_abbrev prior_commit_hash prior_commit_date &&
52 test_cmp 2.txt server/.git/refs.heads.master.out
55 test_expect_success 'retag branch' '
56 git tag -a -m 2.0 2.0 &&
58 new_commit_hash=$(git rev-parse HEAD) &&
59 tag_hash=$(git rev-parse 2.0) &&
60 eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
62 interpolate ../t2201-3.txt 3.txt new_commit_hash tag_hash tag_date &&
63 test_cmp 3.txt server/.git/refs.tags.2.0.out
66 test_expect_success 'create lightweight tag' '
67 echo "$test_name" >a &&
68 git commit -a -m "$test_name" &&
73 new_commit_hash=$(git rev-parse HEAD) &&
74 new_commit_describe=$(git describe HEAD) &&
75 new_commit_date=$(git rev-list --no-walk --pretty=format:%ad HEAD | tail -n 1) &&
77 interpolate ../t2201-4.txt 4.txt new_commit_hash new_commit_describe new_commit_date &&
78 test_cmp 4.txt server/.git/refs.tags.2.1.out