{"thread":{"id":"21349","subject":"Smart HTTP tests","startedAt":"2009-10-25T12:06:17Z","lastAt":"2009-10-28T17:52:26Z","messageCount":9,"participants":["Clemens Buchacher","Shawn O. Pearce","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"125879","messageId":"1256472380-924-1-git-send-email-drizzd@aon.at","threadId":"21349","inReplyTo":null,"subject":"Smart HTTP tests","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2009-10-25T12:06:17Z","receivedAt":"2009-10-25T12:06:17Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"Hi Shawn,\n\nThis is on top of 1e0eb0f0 (Smart HTTP fetch: gzip requests) in pu.\n\nI had to use the SetHandler syntax as suggested by Mark. My apache setup\n(debian 2.2.9-10+lenny) does not resolve the suffix to git-http-backend\nrelative to document root automatically. Instead it will look for repos in\n${GIT_EXEC_PATH}/git-http-backend/git/...\n\nClemens\n"},{"id":"125880","messageId":"1256472380-924-2-git-send-email-drizzd@aon.at","threadId":"21349","inReplyTo":"1256472380-924-1-git-send-email-drizzd@aon.at","subject":"[PATCH 1/3] update http tests according to remote-curl capabilities","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2009-10-25T12:06:18Z","receivedAt":"2009-10-25T12:06:18Z","isPatch":true,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":" o Pushing packed refs is now fixed.\n\n o The transport helper fails if refs are already up-to-date. Add a\n   test for that.\n\n o The transport helper will notice if refs are already up-to-date. We\n   therefore need to update server info in the unpacked-refs test.\n\n o The transport helper will purge deleted branches automatically.\n\nSigned-off-by: Clemens Buchacher <drizzd@aon.at>\n---\n t/t5540-http-push.sh |   14 +++++++++-----\n 1 files changed, 9 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh\nindex f4a2cf6..09edd23 100755\n--- a/t/t5540-http-push.sh\n+++ b/t/t5540-http-push.sh\n@@ -36,6 +36,7 @@ test_expect_success 'setup remote repository' '\n \tcd test_repo.git &&\n \tgit --bare update-server-info &&\n \tmv hooks/post-update.sample hooks/post-update &&\n+\tORIG_HEAD=$(git rev-parse --verify HEAD) &&\n \tcd - &&\n \tmv test_repo.git \"$HTTPD_DOCUMENT_ROOT_PATH\"\n '\n@@ -45,7 +46,7 @@ test_expect_success 'clone remote repository' '\n \tgit clone $HTTPD_URL/test_repo.git test_repo_clone\n '\n \n-test_expect_failure 'push to remote repository with packed refs' '\n+test_expect_success 'push to remote repository with packed refs' '\n \tcd \"$ROOT_PATH\"/test_repo_clone &&\n \t: >path2 &&\n \tgit add path2 &&\n@@ -57,11 +58,15 @@ test_expect_failure 'push to remote repository with packed refs' '\n \t test $HEAD = $(git rev-parse --verify HEAD))\n '\n \n-test_expect_success ' push to remote repository with unpacked refs' '\n+test_expect_failure 'push already up-to-date' '\n+\tgit push\n+'\n+\n+test_expect_success 'push to remote repository with unpacked refs' '\n \t(cd \"$HTTPD_DOCUMENT_ROOT_PATH\"/test_repo.git &&\n \t rm packed-refs &&\n-\t git update-ref refs/heads/master \\\n-\t\t0c973ae9bd51902a28466f3850b543fa66a6aaf4) &&\n+\t git update-ref refs/heads/master $ORIG_HEAD &&\n+\t git --bare update-server-info) &&\n \tgit push &&\n \t(cd \"$HTTPD_DOCUMENT_ROOT_PATH\"/test_repo.git &&\n \t test $HEAD = $(git rev-parse --verify HEAD))\n@@ -113,7 +118,6 @@ test_expect_success 'create and delete remote branch' '\n \tgit push origin dev &&\n \tgit fetch &&\n \tgit push origin :dev &&\n-\tgit branch -d -r origin/dev &&\n \tgit fetch &&\n \ttest_must_fail git show-ref --verify refs/remotes/origin/dev\n '\n-- \n1.6.5.35.ge41a3\n"},{"id":"125881","messageId":"1256472380-924-3-git-send-email-drizzd@aon.at","threadId":"21349","inReplyTo":"1256472380-924-2-git-send-email-drizzd@aon.at","subject":"[PATCH 2/3] remote-helpers: return successfully if everything up-to-date","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2009-10-25T12:06:19Z","receivedAt":"2009-10-25T12:06:19Z","isPatch":true,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"\nSigned-off-by: Clemens Buchacher <drizzd@aon.at>\n---\n t/t5540-http-push.sh |    2 +-\n transport-helper.c   |    2 ++\n 2 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh\nindex 09edd23..2ece661 100755\n--- a/t/t5540-http-push.sh\n+++ b/t/t5540-http-push.sh\n@@ -58,7 +58,7 @@ test_expect_success 'push to remote repository with packed refs' '\n \t test $HEAD = $(git rev-parse --verify HEAD))\n '\n \n-test_expect_failure 'push already up-to-date' '\n+test_expect_success 'push already up-to-date' '\n \tgit push\n '\n \ndiff --git a/transport-helper.c b/transport-helper.c\nindex 16c6641..5078c71 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -263,6 +263,8 @@ static int push_refs(struct transport *transport,\n \t\tstrbuf_addstr(&buf, ref->name);\n \t\tstrbuf_addch(&buf, '\\n');\n \t}\n+\tif (buf.len == 0)\n+\t\treturn 0;\n \n \ttransport->verbose = flags & TRANSPORT_PUSH_VERBOSE ? 1 : 0;\n \tstandard_options(transport);\n-- \n1.6.5.35.ge41a3\n"},{"id":"125882","messageId":"1256472380-924-4-git-send-email-drizzd@aon.at","threadId":"21349","inReplyTo":"1256472380-924-3-git-send-email-drizzd@aon.at","subject":"[PATCH 3/3] add smart HTTP tests","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2009-10-25T12:06:20Z","receivedAt":"2009-10-25T12:06:20Z","isPatch":true,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"Set LIB_HTTPD_GIT to enable smart HTTP tests.\n\nSigned-off-by: Clemens Buchacher <drizzd@aon.at>\n---\n t/lib-httpd.sh          |    9 +++++++++\n t/lib-httpd/apache.conf |   36 +++++++++++++++++++++++++++---------\n t/t5540-http-push.sh    |   46 ++++++++++++++++++++++++++++------------------\n 3 files changed, 64 insertions(+), 27 deletions(-)\n\ndiff --git a/t/lib-httpd.sh b/t/lib-httpd.sh\nindex 6765b08..aaa0a71 100644\n--- a/t/lib-httpd.sh\n+++ b/t/lib-httpd.sh\n@@ -88,6 +88,15 @@ prepare_httpd() {\n \t\t\tsvnrepo=\"http://127.0.0.1:$LIB_HTTPD_PORT/svn\"\n \t\tfi\n \tfi\n+\n+\tif test -n \"$LIB_HTTPD_GIT\"\n+\tthen\n+\t\tHTTPD_PARA=\"$HTTPD_PARA -DGIT\"\n+\tfi\n+\n+\tHTTPD_GIT_PATH=$HTTPD_DOCUMENT_ROOT_PATH/git\n+\tmkdir -p \"$HTTPD_GIT_PATH\"\n+\tHTTPD_GIT_URL=\"$HTTPD_URL/git\"\n }\n \n start_httpd() {\ndiff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf\nindex 21aa42f..d8505f1 100644\n--- a/t/lib-httpd/apache.conf\n+++ b/t/lib-httpd/apache.conf\n@@ -10,15 +10,15 @@ ErrorLog error.log\n </IfModule>\n \n <IfDefine SSL>\n-LoadModule ssl_module modules/mod_ssl.so\n-\n-SSLCertificateFile httpd.pem\n-SSLCertificateKeyFile httpd.pem\n-SSLRandomSeed startup file:/dev/urandom 512\n-SSLRandomSeed connect file:/dev/urandom 512\n-SSLSessionCache none\n-SSLMutex file:ssl_mutex\n-SSLEngine On\n+\tLoadModule ssl_module modules/mod_ssl.so\n+\n+\tSSLCertificateFile httpd.pem\n+\tSSLCertificateKeyFile httpd.pem\n+\tSSLRandomSeed startup file:/dev/urandom 512\n+\tSSLRandomSeed connect file:/dev/urandom 512\n+\tSSLSessionCache none\n+\tSSLMutex file:ssl_mutex\n+\tSSLEngine On\n </IfDefine>\n \n <IfDefine DAV>\n@@ -39,3 +39,21 @@ SSLEngine On\n \t\tSVNPath svnrepo\n \t</Location>\n </IfDefine>\n+\n+<IfDefine GIT>\n+\tLoadModule cgi_module modules/mod_cgi.so\n+\tLoadModule alias_module modules/mod_alias.so\n+\tLoadModule actions_module modules/mod_actions.so\n+\tScriptAlias /git-http-backend ${GIT_EXEC_PATH}/git-http-backend\n+\n+\t<Location /git>\n+\t\tSetHandler git-http-backend\n+\t\tAction git-http-backend /git-http-backend virtual\n+\t</Location>\n+\t<Directory ${GIT_EXEC_PATH}>\n+\t\tOptions None\n+\t</Directory>\n+\t<Files ${GIT_EXEC_PATH}/git-http-backend>\n+\t\tOptions ExecCGI\n+\t</Files>\n+</IfDefine>\ndiff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh\nindex 2ece661..74ca08d 100755\n--- a/t/t5540-http-push.sh\n+++ b/t/t5540-http-push.sh\n@@ -10,7 +10,10 @@ This test runs various sanity checks on http-push.'\n . ./test-lib.sh\n \n ROOT_PATH=\"$PWD\"\n-LIB_HTTPD_DAV=t\n+if test -z \"$LIB_HTTPD_GIT\"\n+then\n+\tLIB_HTTPD_DAV=t\n+fi\n LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5540'}\n \n if git http-push > /dev/null 2>&1 || [ $? -eq 128 ]\n@@ -34,16 +37,21 @@ test_expect_success 'setup remote repository' '\n \tcd - &&\n \tgit clone --bare test_repo test_repo.git &&\n \tcd test_repo.git &&\n-\tgit --bare update-server-info &&\n-\tmv hooks/post-update.sample hooks/post-update &&\n \tORIG_HEAD=$(git rev-parse --verify HEAD) &&\n-\tcd - &&\n-\tmv test_repo.git \"$HTTPD_DOCUMENT_ROOT_PATH\"\n+\tif test -n \"$LIB_HTTPD_GIT\"\n+\tthen\n+\t\tgit config http.receivepack true\n+\telse\n+\t\tgit --bare update-server-info &&\n+\t\tmv hooks/post-update.sample hooks/post-update\n+\tfi\n+\tcd -\n+\tmv test_repo.git \"$HTTPD_GIT_PATH\"\n '\n \n test_expect_success 'clone remote repository' '\n \tcd \"$ROOT_PATH\" &&\n-\tgit clone $HTTPD_URL/test_repo.git test_repo_clone\n+\tgit clone $HTTPD_GIT_URL/test_repo.git test_repo_clone\n '\n \n test_expect_success 'push to remote repository with packed refs' '\n@@ -54,7 +62,7 @@ test_expect_success 'push to remote repository with packed refs' '\n \tgit commit -m path2 &&\n \tHEAD=$(git rev-parse --verify HEAD) &&\n \tgit push &&\n-\t(cd \"$HTTPD_DOCUMENT_ROOT_PATH\"/test_repo.git &&\n+\t(cd \"$HTTPD_GIT_PATH\"/test_repo.git &&\n \t test $HEAD = $(git rev-parse --verify HEAD))\n '\n \n@@ -63,20 +71,20 @@ test_expect_success 'push already up-to-date' '\n '\n \n test_expect_success 'push to remote repository with unpacked refs' '\n-\t(cd \"$HTTPD_DOCUMENT_ROOT_PATH\"/test_repo.git &&\n+\t(cd \"$HTTPD_GIT_PATH\"/test_repo.git &&\n \t rm packed-refs &&\n \t git update-ref refs/heads/master $ORIG_HEAD &&\n \t git --bare update-server-info) &&\n \tgit push &&\n-\t(cd \"$HTTPD_DOCUMENT_ROOT_PATH\"/test_repo.git &&\n+\t(cd \"$HTTPD_GIT_PATH\"/test_repo.git &&\n \t test $HEAD = $(git rev-parse --verify HEAD))\n '\n \n test_expect_success 'http-push fetches unpacked objects' '\n-\tcp -R \"$HTTPD_DOCUMENT_ROOT_PATH\"/test_repo.git \\\n-\t\t\"$HTTPD_DOCUMENT_ROOT_PATH\"/test_repo_unpacked.git &&\n+\tcp -R \"$HTTPD_GIT_PATH\"/test_repo.git \\\n+\t\t\"$HTTPD_GIT_PATH\"/test_repo_unpacked.git &&\n \n-\tgit clone $HTTPD_URL/test_repo_unpacked.git \\\n+\tgit clone $HTTPD_GIT_URL/test_repo_unpacked.git \\\n \t\t\"$ROOT_PATH\"/fetch_unpacked &&\n \n \t# By reset, we force git to retrieve the object\n@@ -85,17 +93,17 @@ test_expect_success 'http-push fetches unpacked objects' '\n \t git remote rm origin &&\n \t git reflog expire --expire=0 --all &&\n \t git prune &&\n-\t git push -f -v $HTTPD_URL/test_repo_unpacked.git master)\n+\t git push -f -v $HTTPD_GIT_URL/test_repo_unpacked.git master)\n '\n \n test_expect_success 'http-push fetches packed objects' '\n-\tcp -R \"$HTTPD_DOCUMENT_ROOT_PATH\"/test_repo.git \\\n-\t\t\"$HTTPD_DOCUMENT_ROOT_PATH\"/test_repo_packed.git &&\n+\tcp -R \"$HTTPD_GIT_PATH\"/test_repo.git \\\n+\t\t\"$HTTPD_GIT_PATH\"/test_repo_packed.git &&\n \n-\tgit clone $HTTPD_URL/test_repo_packed.git \\\n+\tgit clone $HTTPD_GIT_URL/test_repo_packed.git \\\n \t\t\"$ROOT_PATH\"/test_repo_clone_packed &&\n \n-\t(cd \"$HTTPD_DOCUMENT_ROOT_PATH\"/test_repo_packed.git &&\n+\t(cd \"$HTTPD_GIT_PATH\"/test_repo_packed.git &&\n \t git --bare repack &&\n \t git --bare prune-packed) &&\n \n@@ -105,7 +113,7 @@ test_expect_success 'http-push fetches packed objects' '\n \t git remote rm origin &&\n \t git reflog expire --expire=0 --all &&\n \t git prune &&\n-\t git push -f -v $HTTPD_URL/test_repo_packed.git master)\n+\t git push -f -v $HTTPD_GIT_URL/test_repo_packed.git master)\n '\n \n test_expect_success 'create and delete remote branch' '\n@@ -122,6 +130,7 @@ test_expect_success 'create and delete remote branch' '\n \ttest_must_fail git show-ref --verify refs/remotes/origin/dev\n '\n \n+test -n \"$LIB_HTTPD_GIT\" ||\n test_expect_success 'MKCOL sends directory names with trailing slashes' '\n \n \t! grep \"\\\"MKCOL.*[^/] HTTP/[^ ]*\\\"\" < \"$HTTPD_ROOT_PATH\"/access.log\n@@ -134,6 +143,7 @@ x5=\"$x1$x1$x1$x1$x1\"\n x38=\"$x5$x5$x5$x5$x5$x5$x5$x1$x1$x1\"\n x40=\"$x38$x2\"\n \n+test -n \"$LIB_HTTPD_GIT\" ||\n test_expect_success 'PUT and MOVE sends object to URLs with SHA-1 hash suffix' '\n \tsed -e \"s/PUT /OP /\" -e \"s/MOVE /OP /\" \"$HTTPD_ROOT_PATH\"/access.log |\n \tgrep -e \"\\\"OP .*/objects/$x2/${x38}_$x40 HTTP/[.0-9]*\\\" 20[0-9] \"\n-- \n1.6.5.35.ge41a3\n"},{"id":"126072","messageId":"20091028001056.GL10505@spearce.org","threadId":"21349","inReplyTo":"1256472380-924-2-git-send-email-drizzd@aon.at","subject":"Re: [PATCH 1/3] update http tests according to remote-curl capabilities","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-10-28T00:10:56Z","receivedAt":"2009-10-28T00:10:56Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Clemens Buchacher <drizzd@aon.at> wrote:\n>  o Pushing packed refs is now fixed.\n> \n>  o The transport helper fails if refs are already up-to-date. Add a\n>    test for that.\n> \n>  o The transport helper will notice if refs are already up-to-date. We\n>    therefore need to update server info in the unpacked-refs test.\n> \n>  o The transport helper will purge deleted branches automatically.\n> \n> Signed-off-by: Clemens Buchacher <drizzd@aon.at>\n\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\n\n>  t/t5540-http-push.sh |   14 +++++++++-----\n>  1 files changed, 9 insertions(+), 5 deletions(-)\n\n-- \nShawn.\n"},{"id":"126073","messageId":"20091028001125.GM10505@spearce.org","threadId":"21349","inReplyTo":"1256472380-924-3-git-send-email-drizzd@aon.at","subject":"Re: [PATCH 2/3] remote-helpers: return successfully if everything up-to-date","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-10-28T00:11:25Z","receivedAt":"2009-10-28T00:11:25Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Clemens Buchacher <drizzd@aon.at> wrote:\n> \n> Signed-off-by: Clemens Buchacher <drizzd@aon.at>\n\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\n\n>  t/t5540-http-push.sh |    2 +-\n>  transport-helper.c   |    2 ++\n>  2 files changed, 3 insertions(+), 1 deletions(-)\n\n-- \nShawn.\n"},{"id":"126074","messageId":"20091028001737.GN10505@spearce.org","threadId":"21349","inReplyTo":"1256472380-924-4-git-send-email-drizzd@aon.at","subject":"Re: [PATCH 3/3] add smart HTTP tests","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-10-28T00:17:38Z","receivedAt":"2009-10-28T00:17:38Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Clemens Buchacher <drizzd@aon.at> wrote:\n> Set LIB_HTTPD_GIT to enable smart HTTP tests.\n\nMy concern here is we have to run the test suite twice in order to\ntest HTTP support.  We should only run it once, with GIT_TEST_HTTPD=1\nset and have it all run at once.\n\n-- \nShawn.\n"},{"id":"126102","messageId":"7vtyxkrnoq.fsf@alter.siamese.dyndns.org","threadId":"21349","inReplyTo":"20091028001125.GM10505@spearce.org","subject":"Re: [PATCH 2/3] remote-helpers: return successfully if everything up-to-date","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-28T07:18:45Z","receivedAt":"2009-10-28T07:18:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"},{"id":"126161","messageId":"20091028175226.GA10264@localhost","threadId":"21349","inReplyTo":"20091028001737.GN10505@spearce.org","subject":"[PATCH] t5540: test both smart and dumb protocols","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2009-10-28T17:52:26Z","receivedAt":"2009-10-28T17:52:26Z","isPatch":true,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"\nSigned-off-by: Clemens Buchacher <drizzd@aon.at>\n---\n\nOn Tue, Oct 27, 2009 at 05:17:38PM -0700, Shawn O. Pearce wrote:\n> Clemens Buchacher <drizzd@aon.at> wrote:\n> > Set LIB_HTTPD_GIT to enable smart HTTP tests.\n> \n> My concern here is we have to run the test suite twice in order to\n> test HTTP support.  We should only run it once, with GIT_TEST_HTTPD=1\n> set and have it all run at once.\n\nHow about this? The original code is not touched except for the test\ndescription.\n\nClemens\n\n t/lib-httpd.sh       |    2 +\n t/t5540-http-push.sh |  160 ++-----------------------------------------------\n t/test-http-push.sh  |  159 +++++++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 168 insertions(+), 153 deletions(-)\n create mode 100755 t/test-http-push.sh\n\ndiff --git a/t/lib-httpd.sh b/t/lib-httpd.sh\nindex aaa0a71..cf1f1df 100644\n--- a/t/lib-httpd.sh\n+++ b/t/lib-httpd.sh\n@@ -121,4 +121,6 @@ stop_httpd() {\n \n \t\"$LIB_HTTPD_PATH\" -d \"$HTTPD_ROOT_PATH\" \\\n \t\t-f \"$TEST_PATH/apache.conf\" $HTTPD_PARA -k stop\n+\n+\trm -f \"$HTTPD_ROOT_PATH/modules\"\n }\ndiff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh\nindex 049e129..a156f37 100755\n--- a/t/t5540-http-push.sh\n+++ b/t/t5540-http-push.sh\n@@ -1,155 +1,9 @@\n #!/bin/sh\n-#\n-# Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>\n-#\n \n-test_description='test http-push\n-\n-This test runs various sanity checks on http-push.'\n-\n-. ./test-lib.sh\n-\n-ROOT_PATH=\"$PWD\"\n-if test -z \"$LIB_HTTPD_GIT\"\n-then\n-\tLIB_HTTPD_DAV=t\n-fi\n-LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5540'}\n-\n-if git http-push > /dev/null 2>&1 || [ $? -eq 128 ]\n-then\n-\tsay \"skipping test, USE_CURL_MULTI is not defined\"\n-\ttest_done\n-fi\n-\n-. \"$TEST_DIRECTORY\"/lib-httpd.sh\n-start_httpd\n-\n-test_expect_success 'setup remote repository' '\n-\tcd \"$ROOT_PATH\" &&\n-\tmkdir test_repo &&\n-\tcd test_repo &&\n-\tgit init &&\n-\t: >path1 &&\n-\tgit add path1 &&\n-\ttest_tick &&\n-\tgit commit -m initial &&\n-\tcd - &&\n-\tgit clone --bare test_repo test_repo.git &&\n-\tcd test_repo.git &&\n-\tORIG_HEAD=$(git rev-parse --verify HEAD) &&\n-\tif test -n \"$LIB_HTTPD_GIT\"\n-\tthen\n-\t\tgit config http.receivepack true\n-\telse\n-\t\tgit --bare update-server-info &&\n-\t\tmv hooks/post-update.sample hooks/post-update\n-\tfi &&\n-\tcd - &&\n-\tmv test_repo.git \"$HTTPD_GIT_PATH\"\n-'\n-\n-test_expect_success 'clone remote repository' '\n-\tcd \"$ROOT_PATH\" &&\n-\tgit clone $HTTPD_GIT_URL/test_repo.git test_repo_clone\n-'\n-\n-test_expect_success 'push to remote repository with packed refs' '\n-\tcd \"$ROOT_PATH\"/test_repo_clone &&\n-\t: >path2 &&\n-\tgit add path2 &&\n-\ttest_tick &&\n-\tgit commit -m path2 &&\n-\tHEAD=$(git rev-parse --verify HEAD) &&\n-\tgit push &&\n-\t(cd \"$HTTPD_GIT_PATH\"/test_repo.git &&\n-\t test $HEAD = $(git rev-parse --verify HEAD))\n-'\n-\n-test_expect_success 'push already up-to-date' '\n-\tgit push\n-'\n-\n-test_expect_success 'push to remote repository with unpacked refs' '\n-\t(cd \"$HTTPD_GIT_PATH\"/test_repo.git &&\n-\t rm packed-refs &&\n-\t git update-ref refs/heads/master $ORIG_HEAD &&\n-\t git --bare update-server-info) &&\n-\tgit push &&\n-\t(cd \"$HTTPD_GIT_PATH\"/test_repo.git &&\n-\t test $HEAD = $(git rev-parse --verify HEAD))\n-'\n-\n-test_expect_success 'http-push fetches unpacked objects' '\n-\tcp -R \"$HTTPD_GIT_PATH\"/test_repo.git \\\n-\t\t\"$HTTPD_GIT_PATH\"/test_repo_unpacked.git &&\n-\n-\tgit clone $HTTPD_GIT_URL/test_repo_unpacked.git \\\n-\t\t\"$ROOT_PATH\"/fetch_unpacked &&\n-\n-\t# By reset, we force git to retrieve the object\n-\t(cd \"$ROOT_PATH\"/fetch_unpacked &&\n-\t git reset --hard HEAD^ &&\n-\t git remote rm origin &&\n-\t git reflog expire --expire=0 --all &&\n-\t git prune &&\n-\t git push -f -v $HTTPD_GIT_URL/test_repo_unpacked.git master)\n-'\n-\n-test_expect_success 'http-push fetches packed objects' '\n-\tcp -R \"$HTTPD_GIT_PATH\"/test_repo.git \\\n-\t\t\"$HTTPD_GIT_PATH\"/test_repo_packed.git &&\n-\n-\tgit clone $HTTPD_GIT_URL/test_repo_packed.git \\\n-\t\t\"$ROOT_PATH\"/test_repo_clone_packed &&\n-\n-\t(cd \"$HTTPD_GIT_PATH\"/test_repo_packed.git &&\n-\t git --bare repack &&\n-\t git --bare prune-packed) &&\n-\n-\t# By reset, we force git to retrieve the packed object\n-\t(cd \"$ROOT_PATH\"/test_repo_clone_packed &&\n-\t git reset --hard HEAD^ &&\n-\t git remote rm origin &&\n-\t git reflog expire --expire=0 --all &&\n-\t git prune &&\n-\t git push -f -v $HTTPD_GIT_URL/test_repo_packed.git master)\n-'\n-\n-test_expect_success 'create and delete remote branch' '\n-\tcd \"$ROOT_PATH\"/test_repo_clone &&\n-\tgit checkout -b dev &&\n-\t: >path3 &&\n-\tgit add path3 &&\n-\ttest_tick &&\n-\tgit commit -m dev &&\n-\tgit push origin dev &&\n-\tgit fetch &&\n-\tgit push origin :dev &&\n-\tgit fetch &&\n-\ttest_must_fail git show-ref --verify refs/remotes/origin/dev\n-'\n-\n-test -n \"$LIB_HTTPD_GIT\" ||\n-test_expect_success 'MKCOL sends directory names with trailing slashes' '\n-\n-\t! grep \"\\\"MKCOL.*[^/] HTTP/[^ ]*\\\"\" < \"$HTTPD_ROOT_PATH\"/access.log\n-\n-'\n-\n-x1=\"[0-9a-f]\"\n-x2=\"$x1$x1\"\n-x5=\"$x1$x1$x1$x1$x1\"\n-x38=\"$x5$x5$x5$x5$x5$x5$x5$x1$x1$x1\"\n-x40=\"$x38$x2\"\n-\n-test -n \"$LIB_HTTPD_GIT\" ||\n-test_expect_success 'PUT and MOVE sends object to URLs with SHA-1 hash suffix' '\n-\tsed -e \"s/PUT /OP /\" -e \"s/MOVE /OP /\" \"$HTTPD_ROOT_PATH\"/access.log |\n-\tgrep -e \"\\\"OP .*/objects/$x2/${x38}_$x40 HTTP/[.0-9]*\\\" 20[0-9] \"\n-\n-'\n-\n-stop_httpd\n-\n-test_done\n+LIB_HTTPD_GIT=t\n+export LIB_HTTPD_GIT\n+./test-http-push.sh $@\n+sleep 1\n+LIB_HTTPD_GIT=\n+export LIB_HTTPD_GIT\n+./test-http-push.sh $@\ndiff --git a/t/test-http-push.sh b/t/test-http-push.sh\nnew file mode 100755\nindex 0000000..c557541\n--- /dev/null\n+++ b/t/test-http-push.sh\n@@ -0,0 +1,159 @@\n+#!/bin/sh\n+\n+if test -n \"$LIB_HTTPD_GIT\"\n+then\n+\tprotocol=smart\n+else\n+\tprotocol=dumb\n+fi\n+\n+test_description=\"test http-push ($protocol)\n+\n+This test runs various sanity checks on http-push.\"\n+\n+. ./test-lib.sh\n+\n+ROOT_PATH=\"$PWD\"\n+if test -z \"$LIB_HTTPD_GIT\"\n+then\n+\tLIB_HTTPD_DAV=t\n+fi\n+LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5540'}\n+\n+if git http-push > /dev/null 2>&1 || [ $? -eq 128 ]\n+then\n+\tsay \"skipping test, USE_CURL_MULTI is not defined\"\n+\ttest_done\n+fi\n+\n+. \"$TEST_DIRECTORY\"/lib-httpd.sh\n+start_httpd\n+\n+test_expect_success 'setup remote repository' '\n+\tcd \"$ROOT_PATH\" &&\n+\tmkdir test_repo &&\n+\tcd test_repo &&\n+\tgit init &&\n+\t: >path1 &&\n+\tgit add path1 &&\n+\ttest_tick &&\n+\tgit commit -m initial &&\n+\tcd - &&\n+\tgit clone --bare test_repo test_repo.git &&\n+\tcd test_repo.git &&\n+\tORIG_HEAD=$(git rev-parse --verify HEAD) &&\n+\tif test -n \"$LIB_HTTPD_GIT\"\n+\tthen\n+\t\tgit config http.receivepack true\n+\telse\n+\t\tgit --bare update-server-info &&\n+\t\tmv hooks/post-update.sample hooks/post-update\n+\tfi &&\n+\tcd - &&\n+\tmv test_repo.git \"$HTTPD_GIT_PATH\"\n+'\n+\n+test_expect_success 'clone remote repository' '\n+\tcd \"$ROOT_PATH\" &&\n+\tgit clone $HTTPD_GIT_URL/test_repo.git test_repo_clone\n+'\n+\n+test_expect_success 'push to remote repository with packed refs' '\n+\tcd \"$ROOT_PATH\"/test_repo_clone &&\n+\t: >path2 &&\n+\tgit add path2 &&\n+\ttest_tick &&\n+\tgit commit -m path2 &&\n+\tHEAD=$(git rev-parse --verify HEAD) &&\n+\tgit push &&\n+\t(cd \"$HTTPD_GIT_PATH\"/test_repo.git &&\n+\t test $HEAD = $(git rev-parse --verify HEAD))\n+'\n+\n+test_expect_success 'push already up-to-date' '\n+\tgit push\n+'\n+\n+test_expect_success 'push to remote repository with unpacked refs' '\n+\t(cd \"$HTTPD_GIT_PATH\"/test_repo.git &&\n+\t rm packed-refs &&\n+\t git update-ref refs/heads/master $ORIG_HEAD &&\n+\t git --bare update-server-info) &&\n+\tgit push &&\n+\t(cd \"$HTTPD_GIT_PATH\"/test_repo.git &&\n+\t test $HEAD = $(git rev-parse --verify HEAD))\n+'\n+\n+test_expect_success 'http-push fetches unpacked objects' '\n+\tcp -R \"$HTTPD_GIT_PATH\"/test_repo.git \\\n+\t\t\"$HTTPD_GIT_PATH\"/test_repo_unpacked.git &&\n+\n+\tgit clone $HTTPD_GIT_URL/test_repo_unpacked.git \\\n+\t\t\"$ROOT_PATH\"/fetch_unpacked &&\n+\n+\t# By reset, we force git to retrieve the object\n+\t(cd \"$ROOT_PATH\"/fetch_unpacked &&\n+\t git reset --hard HEAD^ &&\n+\t git remote rm origin &&\n+\t git reflog expire --expire=0 --all &&\n+\t git prune &&\n+\t git push -f -v $HTTPD_GIT_URL/test_repo_unpacked.git master)\n+'\n+\n+test_expect_success 'http-push fetches packed objects' '\n+\tcp -R \"$HTTPD_GIT_PATH\"/test_repo.git \\\n+\t\t\"$HTTPD_GIT_PATH\"/test_repo_packed.git &&\n+\n+\tgit clone $HTTPD_GIT_URL/test_repo_packed.git \\\n+\t\t\"$ROOT_PATH\"/test_repo_clone_packed &&\n+\n+\t(cd \"$HTTPD_GIT_PATH\"/test_repo_packed.git &&\n+\t git --bare repack &&\n+\t git --bare prune-packed) &&\n+\n+\t# By reset, we force git to retrieve the packed object\n+\t(cd \"$ROOT_PATH\"/test_repo_clone_packed &&\n+\t git reset --hard HEAD^ &&\n+\t git remote rm origin &&\n+\t git reflog expire --expire=0 --all &&\n+\t git prune &&\n+\t git push -f -v $HTTPD_GIT_URL/test_repo_packed.git master)\n+'\n+\n+test_expect_success 'create and delete remote branch' '\n+\tcd \"$ROOT_PATH\"/test_repo_clone &&\n+\tgit checkout -b dev &&\n+\t: >path3 &&\n+\tgit add path3 &&\n+\ttest_tick &&\n+\tgit commit -m dev &&\n+\tgit push origin dev &&\n+\tgit fetch &&\n+\tgit push origin :dev &&\n+\tgit fetch &&\n+\ttest_must_fail git show-ref --verify refs/remotes/origin/dev\n+'\n+\n+test -n \"$LIB_HTTPD_GIT\" ||\n+test_expect_success 'MKCOL sends directory names with trailing slashes' '\n+\n+\t! grep \"\\\"MKCOL.*[^/] HTTP/[^ ]*\\\"\" < \"$HTTPD_ROOT_PATH\"/access.log\n+\n+'\n+\n+x1=\"[0-9a-f]\"\n+x2=\"$x1$x1\"\n+x5=\"$x1$x1$x1$x1$x1\"\n+x38=\"$x5$x5$x5$x5$x5$x5$x5$x1$x1$x1\"\n+x40=\"$x38$x2\"\n+\n+test -n \"$LIB_HTTPD_GIT\" ||\n+test_expect_success 'PUT and MOVE sends object to URLs with SHA-1 hash suffix' '\n+\tsed -e \"s/PUT /OP /\" -e \"s/MOVE /OP /\" \"$HTTPD_ROOT_PATH\"/access.log |\n+\tgrep -e \"\\\"OP .*/objects/$x2/${x38}_$x40 HTTP/[.0-9]*\\\" 20[0-9] \"\n+\n+'\n+\n+stop_httpd\n+\n+test_done\n-- \n1.6.5.1.208.gd7b37\n"}]}