From 40ae911acc61e38de4f4e7517b921dc30c9822ea Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Fri, 29 Aug 2008 11:06:06 -0500 Subject: [PATCH] Re-describe each commit. --- server/functions | 9 +++++++-- server/post-receive-trac | 2 +- tests/t3000-server-post-receive-trac.sh | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/server/functions b/server/functions index 5e4616a..ff16d51 100644 --- a/server/functions +++ b/server/functions @@ -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 } diff --git a/server/post-receive-trac b/server/post-receive-trac index 21ac0f4..1cd5e9f 100644 --- a/server/post-receive-trac +++ b/server/post-receive-trac @@ -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 diff --git a/tests/t3000-server-post-receive-trac.sh b/tests/t3000-server-post-receive-trac.sh index 8468b57..9caa5ca 100644 --- a/tests/t3000-server-post-receive-trac.sh +++ b/tests/t3000-server-post-receive-trac.sh @@ -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 -- 2.39.5