Re-describe each commit.
authorStephen Haberman <stephen@exigencecorp.com>
Fri, 29 Aug 2008 16:06:06 +0000 (11:06 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Fri, 29 Aug 2008 16:06:06 +0000 (11:06 -0500)
server/functions
server/post-receive-trac
tests/t3000-server-post-receive-trac.sh

index 5e4616a..ff16d51 100644 (file)
@@ -146,9 +146,14 @@ function set_rev_types() {
 #
 # The email subject will contain the best description of the ref that we can build from the parameters
 function set_describe() {
-       describe=$(git describe $rev 2>/dev/null)
+       rev_to_describe="$rev"
+       if [ "$1" != "" ] ; then
+               rev_to_describe="$1"
+       fi
+
+       describe=$(git describe $rev_to_describe 2>/dev/null)
        if [ -z "$describe" ]; then
-               describe=$rev
+               describe=$rev_to_describe
        fi
 }
 
index 21ac0f4..1cd5e9f 100644 (file)
@@ -18,9 +18,9 @@ while read oldrev newrev refname ; do
 
        set_new_commits
        set_rev_types
-       set_describe
 
        echo "$new_commits" | git rev-list --reverse --stdin | while read commit ; do
+               set_describe "$commit"
                "$PYTHON" "$POST_RECEIVE_TRAC" "$TRAC_ENV" "$short_refname" "$describe" "$commit"
        done
 done
index 8468b57..9caa5ca 100644 (file)
@@ -72,5 +72,21 @@ test_expect_success 'update branch with abbreviation' '
        cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $new_commit_describe $new_commit_hash"
 '
 
+test_expect_success 'update branch with abbreviation and two commits' '
+       echo "$test_name 1" >a &&
+       git commit -a -m "changed on topic2 1" &&
+       first_commit_describe=$(git describe HEAD) &&
+       first_commit_hash=$(git rev-parse HEAD) &&
+
+       echo "$test_name 2" >a &&
+       git commit -a -m "changed on topic2 2" &&
+       second_commit_describe=$(git describe HEAD) &&
+       second_commit_hash=$(git rev-parse HEAD) &&
+
+       git push origin topic2 2>push.err &&
+       cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $first_commit_describe $first_commit_hash" &&
+       cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $second_commit_describe $second_commit_hash"
+'
+
 test_done