]> git.droids-corp.org - git-central.git/commitdiff
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 5e4616a29891efa90c1cd55aab2ec2bc1f8a1f07..ff16d51a8f63909107f04e07831092441a9f3c41 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 21ac0f44094b5d054cd19439b2f3e75387a0c8d7..1cd5e9f5aa77ba63c0814081c6d82012e238e655 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 8468b57fafd6c5e658f4913777af827ec0931950..9caa5cafe6004f18aa319dfbfc6e0aa46871ff75 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