3 test_description='server post receive trac with commit numbers'
8 export TRAC_ENV=/foo/trac
10 test_expect_success 'setup' '
13 git commit -m "setup" &&
14 git clone ./. server &&
15 rm -fr server/.git/hooks &&
16 git remote add origin ./server
19 install_post_receive_hook 'post-receive-assign-commit-numbers' 'post-receive-trac'
21 test_expect_success 'new branch' '
22 git checkout -b topic1 master &&
23 echo "$test_name" >a &&
24 git commit -a -m "changed on topic1" &&
25 new_commit_hash=$(git rev-parse HEAD) &&
26 git push origin topic1 2>push.err &&
27 cat push.err | grep "/foo/trac topic1 $new_commit_hash r/1 $new_commit_hash"
30 test_expect_success 'new branch with already existing does not double tap' '
31 git checkout -b topic2 topic1 &&
32 existing_commit_hash=$(git rev-parse HEAD) &&
33 git push origin topic2 2>push.err &&
34 ! cat push.err | grep "/foo/trac topic2"
37 test_expect_success 'update branch' '
39 echo "$test_name" >a &&
40 git commit -a -m "changed on topic2" &&
41 new_commit_hash=$(git rev-parse HEAD) &&
42 git push origin topic2 2>push.err &&
43 cat push.err | grep "/foo/trac topic2 $new_commit_hash r/2 $new_commit_hash"
46 test_expect_success 'update branch to an already published commit does not double tap' '
47 # Make topic1 catch up to topic2, which will be a fast forward that does need re-tapped
48 git checkout topic2 &&
49 topic2_hash=$(git rev-parse HEAD) &&
51 git checkout topic1 &&
53 topic1_hash=$(git rev-parse HEAD) &&
55 git push 2>push.err &&
57 ! cat push.err | grep "/foo/trac topic2"
58 ! cat push.err | grep "/foo/trac topic1"
61 test_expect_success 'update branch with abbreviation' '
63 git tag -m "release1" release1 &&
66 echo "$test_name" >a &&
67 git commit -a -m "changed on topic2" &&
68 new_commit_describe=$(git describe HEAD) &&
69 new_commit_hash=$(git rev-parse HEAD) &&
70 git push origin topic2 2>push.err &&
71 cat push.err | grep "/foo/trac topic2 $new_commit_describe r/3 $new_commit_hash"
74 test_expect_success 'update branch with abbreviation and two commits' '
75 echo "$test_name 1" >a &&
76 git commit -a -m "changed on topic2 1" &&
77 first_commit_describe=$(git describe HEAD) &&
78 first_commit_hash=$(git rev-parse HEAD) &&
80 echo "$test_name 2" >a &&
81 git commit -a -m "changed on topic2 2" &&
82 second_commit_describe=$(git describe HEAD) &&
83 second_commit_hash=$(git rev-parse HEAD) &&
85 git push origin topic2 2>push.err &&
86 cat push.err | grep "/foo/trac topic2 $first_commit_describe r/4 $first_commit_hash" &&
87 cat push.err | grep "/foo/trac topic2 $second_commit_describe r/5 $second_commit_hash"