From b91487680fa926b1b388bc91abe38f86a684c9ed Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Tue, 11 Nov 2008 14:13:25 -0600 Subject: [PATCH] Use dirname instead of an POST_RECEIVE_TRAC environment variable. --- server/post-receive-trac | 2 +- tests/t3000-server-post-receive-trac.sh | 17 ++++++++--------- ...ver-post-receive-trac-with-commit-numbers.sh | 17 ++++++++--------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/server/post-receive-trac b/server/post-receive-trac index 1546197..083837c 100644 --- a/server/post-receive-trac +++ b/server/post-receive-trac @@ -24,7 +24,7 @@ while read oldrev newrev refname ; do set_describe_tags "$commit" author="$(git rev-list -n 1 $commit --pretty=format:'%cn <%ce>' | grep -v $commit)" message="$(git rev-list -n 1 $commit --pretty=format:'%s%n%b' | grep -v $commit)" - "$PYTHON" "$POST_RECEIVE_TRAC" "$TRAC_ENV" "$short_refname" "$describe" "$describe_tags" "$commit" "$author" "$message" + "$PYTHON" "$(dirname $0)/post-receive-trac.py" "$TRAC_ENV" "$short_refname" "$describe" "$describe_tags" "$commit" "$author" "$message" # Trac will crap out if we submit ticket refs too quickly # http://trac.edgewall.org/ticket/6466 sleep 1 diff --git a/tests/t3000-server-post-receive-trac.sh b/tests/t3000-server-post-receive-trac.sh index 8c8c556..bdb783e 100644 --- a/tests/t3000-server-post-receive-trac.sh +++ b/tests/t3000-server-post-receive-trac.sh @@ -5,7 +5,6 @@ test_description='server update lock check' . ./test-lib.sh export PYTHON=echo -export POST_RECEIVE_TRAC=/foo/post-receive-trac.py export TRAC_ENV=/foo/trac test_expect_success 'setup' ' @@ -25,14 +24,14 @@ test_expect_success 'new branch' ' git commit -a -m "changed on topic1" && new_commit_hash=$(git rev-parse HEAD) && git push origin topic1 2>push.err && - cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic1 $new_commit_hash $new_commit_hash $new_commit_hash" + cat push.err | grep "/foo/trac topic1 $new_commit_hash $new_commit_hash $new_commit_hash" ' test_expect_success 'new branch with already existing does not double tap' ' git checkout -b topic2 topic1 && existing_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" + ! cat push.err | grep "/foo/trac topic2" ' test_expect_success 'update branch' ' @@ -41,7 +40,7 @@ test_expect_success 'update branch' ' git commit -a -m "changed on topic2" && new_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 $new_commit_hash $new_commit_hash $new_commit_hash" + cat push.err | grep "/foo/trac topic2 $new_commit_hash $new_commit_hash $new_commit_hash" ' test_expect_success 'update branch to an already published commit does not double tap' ' @@ -55,8 +54,8 @@ test_expect_success 'update branch to an already published commit does not doubl git push 2>push.err && - ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2" - ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic1" + ! cat push.err | grep "/foo/trac topic2" + ! cat push.err | grep "/foo/trac topic1" ' test_expect_success 'update branch with abbreviation' ' @@ -69,7 +68,7 @@ test_expect_success 'update branch with abbreviation' ' new_commit_describe=$(git describe HEAD) && new_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 $new_commit_describe $new_commit_describe $new_commit_hash" + cat push.err | grep "/foo/trac topic2 $new_commit_describe $new_commit_describe $new_commit_hash" ' test_expect_success 'update branch with abbreviation and two commits' ' @@ -84,8 +83,8 @@ test_expect_success 'update branch with abbreviation and two commits' ' 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_describe $first_commit_hash" && - cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $second_commit_describe $second_commit_describe $second_commit_hash" + cat push.err | grep "/foo/trac topic2 $first_commit_describe $first_commit_describe $first_commit_hash" && + cat push.err | grep "/foo/trac topic2 $second_commit_describe $second_commit_describe $second_commit_hash" ' test_done diff --git a/tests/t3001-server-post-receive-trac-with-commit-numbers.sh b/tests/t3001-server-post-receive-trac-with-commit-numbers.sh index 7e8abdc..b4e5d65 100644 --- a/tests/t3001-server-post-receive-trac-with-commit-numbers.sh +++ b/tests/t3001-server-post-receive-trac-with-commit-numbers.sh @@ -5,7 +5,6 @@ test_description='server post receive trac with commit numbers' . ./test-lib.sh export PYTHON=echo -export POST_RECEIVE_TRAC=/foo/post-receive-trac.py export TRAC_ENV=/foo/trac test_expect_success 'setup' ' @@ -25,14 +24,14 @@ test_expect_success 'new branch' ' git commit -a -m "changed on topic1" && new_commit_hash=$(git rev-parse HEAD) && git push origin topic1 2>push.err && - cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic1 $new_commit_hash r/1 $new_commit_hash" + cat push.err | grep "/foo/trac topic1 $new_commit_hash r/1 $new_commit_hash" ' test_expect_success 'new branch with already existing does not double tap' ' git checkout -b topic2 topic1 && existing_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" + ! cat push.err | grep "/foo/trac topic2" ' test_expect_success 'update branch' ' @@ -41,7 +40,7 @@ test_expect_success 'update branch' ' git commit -a -m "changed on topic2" && new_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 $new_commit_hash r/2 $new_commit_hash" + cat push.err | grep "/foo/trac topic2 $new_commit_hash r/2 $new_commit_hash" ' test_expect_success 'update branch to an already published commit does not double tap' ' @@ -55,8 +54,8 @@ test_expect_success 'update branch to an already published commit does not doubl git push 2>push.err && - ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2" - ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic1" + ! cat push.err | grep "/foo/trac topic2" + ! cat push.err | grep "/foo/trac topic1" ' test_expect_success 'update branch with abbreviation' ' @@ -69,7 +68,7 @@ test_expect_success 'update branch with abbreviation' ' new_commit_describe=$(git describe HEAD) && new_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 $new_commit_describe r/3 $new_commit_hash" + cat push.err | grep "/foo/trac topic2 $new_commit_describe r/3 $new_commit_hash" ' test_expect_success 'update branch with abbreviation and two commits' ' @@ -84,8 +83,8 @@ test_expect_success 'update branch with abbreviation and two commits' ' 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 r/4 $first_commit_hash" && - cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $second_commit_describe r/5 $second_commit_hash" + cat push.err | grep "/foo/trac topic2 $first_commit_describe r/4 $first_commit_hash" && + cat push.err | grep "/foo/trac topic2 $second_commit_describe r/5 $second_commit_hash" ' test_done -- 2.39.5