]> git.droids-corp.org - git-central.git/commitdiff
Use permanent shims as the test hook scripts. Not used by all the tests yet.
authorStephen Haberman <stephen@exigencecorp.com>
Sun, 13 Jul 2008 21:49:31 +0000 (16:49 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Sun, 13 Jul 2008 21:49:31 +0000 (16:49 -0500)
tests/t2100-server-update-stable.sh
tests/t2200-server-post-receive-email.sh
tests/t2201-server-post-receive-email-tags.sh
tests/t2202-server-post-receive-email-branches.sh
tests/test-lib.sh

index 0961b998ecb150db48f9798cf47edaa3b0cfc60e..1364f5b699777fe7df06063d6d3d857f81d9d348 100644 (file)
@@ -14,7 +14,7 @@ test_expect_success 'setup' '
 '
 
 # setup the update hook
-install_server_hook 'update-stable' 'update'
+install_update_hook 'update-stable'
 
 test_expect_success 'initial stable commit works', '
        # do one stable-less commit
index c49ad53a643721db7a2246ffe4cc94b918eb4efd..2ac0dcb637c95269ba7c0bfda23878f728f85c1d 100644 (file)
@@ -19,7 +19,7 @@ test_expect_success 'setup' '
        echo cbas >./server/.git/description
 '
 
-install_server_hook 'post-receive-email' 'post-receive'
+install_post_receive_hook 'post-receive-email'
 
 test_expect_success 'simple commit' '
        echo $test_name >a &&
index ed823da1e18811580aa5f422540a9e033bd8c30c..4e0e0f3597c1dc1665df569e3781e81644ca1c75 100644 (file)
@@ -19,7 +19,7 @@ test_expect_success 'setup' '
        echo cbas >./server/.git/description
 '
 
-install_server_hook 'post-receive-email' 'post-receive'
+install_post_receive_hook 'post-receive-email'
 
 test_expect_success 'create tag' '
        git tag -a -m 1.0 1.0 &&
index ad34ad257e843a36e6fc8ab7ca3ae0b54f33ca21..0b35c612d6af27c0278539c88e7b62345c3da70d 100644 (file)
@@ -19,7 +19,7 @@ test_expect_success 'setup' '
        echo cbas >./server/.git/description
 '
 
-install_server_hook 'post-receive-email' 'post-receive'
+install_post_receive_hook 'post-receive-email'
 
 test_expect_success 'create branch' '
        git checkout -b topic master &&
index 9d35ad6cfa692069e5c67f776759fe0ba780c236..f88ad665edf641a6b90d5a1cd8e3a0a34e70aec6 100644 (file)
@@ -462,12 +462,34 @@ install_server_hook () {
 install_update_hook () {
        mkdir -p "server/.git/hooks"
        hook="server/.git/hooks/update"
-       chmod +x $hook
 
        echo "#!/bin/sh" >$hook
        for ((i=1;i<=$#;i+=1)); do
                eval script_name="$"$i
                echo "../../../../server/$script_name \$1 \$2 \$3" >>$hook
        done
+
+       chmod +x $hook
+}
+
+install_post_receive_hook () {
+       mkdir -p "server/.git/hooks"
+       hook="server/.git/hooks/post-receive"
+
+       cat >$hook <<-'EOF'
+               #!/bin/sh
+               nl=$'\n'
+               input=""
+               while read newref oldref refname ; do
+                       input="$input$newref $oldref $refname$nl"
+               done
+       EOF
+
+       for ((i=1;i<=$#;i+=1)); do
+               eval script_name="$"$i
+               echo "echo -n \"\$input\" | ../../../../server/$script_name" >>$hook
+       done
+
+       chmod +x $hook
 }