3 test_description='server post receive trac with commit numbers'
8 export POST_RECEIVE_TRAC=/foo/post-receive-trac.py
9 export TRAC_ENV=/foo/trac
11 test_expect_success 'setup' '
14 git commit -m "setup" &&
15 git clone ./. server &&
16 rm -fr server/.git/hooks &&
17 git remote add origin ./server
20 install_post_receive_hook 'post-receive-assign-commit-numbers' 'post-receive-trac'
22 test_expect_success 'new branch' '
23 git checkout -b topic1 master &&
24 echo "$test_name" >a &&
25 git commit -a -m "changed on topic1" &&
26 new_commit_hash=$(git rev-parse HEAD) &&
27 git push origin topic1 2>push.err &&
28 cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic1 $new_commit_hash r/1 $new_commit_hash"
31 test_expect_success 'new branch with already existing does not double tap' '
32 git checkout -b topic2 topic1 &&
33 existing_commit_hash=$(git rev-parse HEAD) &&
34 git push origin topic2 2>push.err &&
35 ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2"
38 test_expect_success 'update branch' '
40 echo "$test_name" >a &&
41 git commit -a -m "changed on topic2" &&
42 new_commit_hash=$(git rev-parse HEAD) &&
43 git push origin topic2 2>push.err &&
44 cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $new_commit_hash r/2 $new_commit_hash"
47 test_expect_success 'update branch to an already published commit does not double tap' '
48 # Make topic1 catch up to topic2, which will be a fast forward that does need re-tapped
49 git checkout topic2 &&
50 topic2_hash=$(git rev-parse HEAD) &&
52 git checkout topic1 &&
54 topic1_hash=$(git rev-parse HEAD) &&
56 git push 2>push.err &&
58 ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2"
59 ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic1"
62 test_expect_success 'update branch with abbreviation' '
64 git tag -m "release1" release1 &&
67 echo "$test_name" >a &&
68 git commit -a -m "changed on topic2" &&
69 new_commit_describe=$(git describe HEAD) &&
70 new_commit_hash=$(git rev-parse HEAD) &&
71 git push origin topic2 2>push.err &&
72 cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $new_commit_describe r/3 $new_commit_hash"
75 test_expect_success 'update branch with abbreviation and two commits' '
76 echo "$test_name 1" >a &&
77 git commit -a -m "changed on topic2 1" &&
78 first_commit_describe=$(git describe HEAD) &&
79 first_commit_hash=$(git rev-parse HEAD) &&
81 echo "$test_name 2" >a &&
82 git commit -a -m "changed on topic2 2" &&
83 second_commit_describe=$(git describe HEAD) &&
84 second_commit_hash=$(git rev-parse HEAD) &&
86 git push origin topic2 2>push.err &&
87 cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $first_commit_describe r/4 $first_commit_hash" &&
88 cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $second_commit_describe r/5 $second_commit_hash"