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 annotated 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 annotated tagged branch' '
38 old_commit_hash=$(git rev-parse HEAD) &&
39 old_commit_abbrev=$(git rev-parse --short HEAD) &&
41 echo "$test_name" >a &&
42 git commit -a -m "$test_name" &&
43 prior_commit_hash=$(git rev-parse HEAD) &&
44 prior_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
45 prior_commit_abbrev=$(git rev-parse --short HEAD) &&
47 echo "$test_name 2" >a &&
48 git commit -a -m "$test_name 2" &&
49 new_commit_hash=$(git rev-parse HEAD) &&
50 new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
51 new_commit_abbrev=$(git rev-parse --short HEAD) &&
54 new_commit_abbrev=$(git rev-list -n 1 --pretty=format:%h HEAD | grep -v commit) &&
55 interpolate ../t2201-2.txt 2.txt old_commit_hash new_commit_hash new_commit_date new_commit_abbrev prior_commit_hash prior_commit_date old_commit_abbrev prior_commit_abbrev new_commit_abbrev &&
56 test_cmp 2.txt server/.git/refs.heads.master.out
59 test_expect_success 're-annotated tag branch' '
60 git tag -a -m 2.0 2.0 &&
62 new_commit_hash=$(git rev-parse HEAD) &&
63 tag_hash=$(git rev-parse 2.0) &&
64 eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
66 interpolate ../t2201-3.txt 3.txt new_commit_hash tag_hash tag_date &&
67 test_cmp 3.txt server/.git/refs.tags.2.0.out
70 test_expect_success 'force update annotated tag' '
71 old_tag_hash=$(git rev-parse 2.0) &&
73 echo "$test_name" >a &&
74 git commit -a -m "$test_name" &&
75 new_commit_hash=$(git rev-parse HEAD) &&
76 new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
78 git tag -f -a -m 2.0 2.0 &&
80 new_tag_hash=$(git rev-parse 2.0) &&
81 eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
83 interpolate ../t2201-7.txt 7.txt old_tag_hash new_commit_hash new_tag_hash tag_date &&
84 test_cmp 7.txt server/.git/refs.tags.2.0.out
87 test_expect_success 'delete annotated tag' '
88 old_tag_hash=$(git rev-parse 2.0) &&
89 eval $(git for-each-ref --shell "--format=old_tag_date=%(taggerdate)" refs/tags/2.0) &&
92 git push origin :refs/tags/2.0 &&
94 new_commit_describe=$(git describe HEAD) &&
95 new_commit_hash=$(git rev-parse HEAD) &&
97 interpolate ../t2201-8.txt 8.txt old_tag_hash old_tag_date new_commit_describe new_commit_hash &&
98 test_cmp 8.txt server/.git/refs.tags.2.0.out
101 test_expect_success 'create lightweight tag' '
102 echo "$test_name" >a &&
103 git commit -a -m "$test_name" &&
108 new_commit_hash=$(git rev-parse HEAD) &&
109 new_commit_describe=$(git describe HEAD) &&
110 new_commit_date=$(git rev-list --no-walk --pretty=format:%ad HEAD | tail -n 1) &&
112 interpolate ../t2201-4.txt 4.txt new_commit_hash new_commit_describe new_commit_date &&
113 test_cmp 4.txt server/.git/refs.tags.2.1.out
116 test_expect_success 'force update lightweight tag' '
117 old_commit_hash=$(git rev-parse HEAD) &&
118 echo "$test_name" >a &&
119 git commit -a -m "$test_name" &&
124 new_commit_hash=$(git rev-parse HEAD) &&
125 new_commit_describe=$(git describe HEAD) &&
126 new_commit_date=$(git rev-list --no-walk --pretty=format:%ad HEAD | tail -n 1) &&
128 interpolate ../t2201-5.txt 5.txt new_commit_hash new_commit_describe new_commit_date old_commit_hash &&
129 test_cmp 5.txt server/.git/refs.tags.2.1.out
132 test_expect_success 'delete lightweight tag' '
133 old_commit_hash=$(git rev-parse HEAD) &&
134 old_commit_describe=$(git describe HEAD) &&
136 git push origin :refs/tags/2.1 &&
138 interpolate ../t2201-6.txt 6.txt old_commit_hash old_commit_describe &&
139 test_cmp 6.txt server/.git/refs.tags.2.1.out