diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 6765b08..aaa0a71 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -88,6 +88,15 @@ prepare_httpd() {
svnrepo="http://127.0.0.1:$LIB_HTTPD_PORT/svn"
fi
fi
+
+ if test -n "$LIB_HTTPD_GIT"
+ then
+ HTTPD_PARA="$HTTPD_PARA -DGIT"
+ fi
+
+ HTTPD_GIT_PATH=$HTTPD_DOCUMENT_ROOT_PATH/git
+ mkdir -p "$HTTPD_GIT_PATH"
+ HTTPD_GIT_URL="$HTTPD_URL/git"
}
start_httpd() {diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 21aa42f..d8505f1 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -10,15 +10,15 @@ ErrorLog error.log
</IfModule>
<IfDefine SSL>
-LoadModule ssl_module modules/mod_ssl.so
-
-SSLCertificateFile httpd.pem
-SSLCertificateKeyFile httpd.pem
-SSLRandomSeed startup file:/dev/urandom 512
-SSLRandomSeed connect file:/dev/urandom 512
-SSLSessionCache none
-SSLMutex file:ssl_mutex
-SSLEngine On
+ LoadModule ssl_module modules/mod_ssl.so
+
+ SSLCertificateFile httpd.pem
+ SSLCertificateKeyFile httpd.pem
+ SSLRandomSeed startup file:/dev/urandom 512
+ SSLRandomSeed connect file:/dev/urandom 512
+ SSLSessionCache none
+ SSLMutex file:ssl_mutex
+ SSLEngine On
</IfDefine>
<IfDefine DAV>
@@ -39,3 +39,21 @@ SSLEngine On
SVNPath svnrepo
</Location>
</IfDefine>
+
+<IfDefine GIT>
+ LoadModule cgi_module modules/mod_cgi.so
+ LoadModule alias_module modules/mod_alias.so
+ LoadModule actions_module modules/mod_actions.so
+ ScriptAlias /git-http-backend ${GIT_EXEC_PATH}/git-http-backend
+
+ <Location /git>
+ SetHandler git-http-backend
+ Action git-http-backend /git-http-backend virtual
+ </Location>
+ <Directory ${GIT_EXEC_PATH}>
+ Options None
+ </Directory>
+ <Files ${GIT_EXEC_PATH}/git-http-backend>
+ Options ExecCGI
+ </Files>
+</IfDefine>diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index 2ece661..74ca08d 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -10,7 +10,10 @@ This test runs various sanity checks on http-push.'
. ./test-lib.sh
ROOT_PATH="$PWD"
-LIB_HTTPD_DAV=t
+if test -z "$LIB_HTTPD_GIT"
+then
+ LIB_HTTPD_DAV=t
+fi
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5540'}
if git http-push > /dev/null 2>&1 || [ $? -eq 128 ]@@ -34,16 +37,21 @@ test_expect_success 'setup remote repository' '
cd - &&
git clone --bare test_repo test_repo.git &&
cd test_repo.git &&
- git --bare update-server-info &&
- mv hooks/post-update.sample hooks/post-update &&
ORIG_HEAD=$(git rev-parse --verify HEAD) &&
- cd - &&
- mv test_repo.git "$HTTPD_DOCUMENT_ROOT_PATH"
+ if test -n "$LIB_HTTPD_GIT"
+ then
+ git config http.receivepack true
+ else
+ git --bare update-server-info &&
+ mv hooks/post-update.sample hooks/post-update
+ fi
+ cd -
+ mv test_repo.git "$HTTPD_GIT_PATH"
'
test_expect_success 'clone remote repository' '
cd "$ROOT_PATH" &&
- git clone $HTTPD_URL/test_repo.git test_repo_clone
+ git clone $HTTPD_GIT_URL/test_repo.git test_repo_clone
'
test_expect_success 'push to remote repository with packed refs' '
@@ -54,7 +62,7 @@ test_expect_success 'push to remote repository with packed refs' '
git commit -m path2 &&
HEAD=$(git rev-parse --verify HEAD) &&
git push &&
- (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
+ (cd "$HTTPD_GIT_PATH"/test_repo.git &&
test $HEAD = $(git rev-parse --verify HEAD))
'
@@ -63,20 +71,20 @@ test_expect_success 'push already up-to-date' '
'
test_expect_success 'push to remote repository with unpacked refs' '
- (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
+ (cd "$HTTPD_GIT_PATH"/test_repo.git &&
rm packed-refs &&
git update-ref refs/heads/master $ORIG_HEAD &&
git --bare update-server-info) &&
git push &&
- (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
+ (cd "$HTTPD_GIT_PATH"/test_repo.git &&
test $HEAD = $(git rev-parse --verify HEAD))
'
test_expect_success 'http-push fetches unpacked objects' '
- cp -R "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
- "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_unpacked.git &&
+ cp -R "$HTTPD_GIT_PATH"/test_repo.git \
+ "$HTTPD_GIT_PATH"/test_repo_unpacked.git &&
- git clone $HTTPD_URL/test_repo_unpacked.git \
+ git clone $HTTPD_GIT_URL/test_repo_unpacked.git \
"$ROOT_PATH"/fetch_unpacked &&
# By reset, we force git to retrieve the object
@@ -85,17 +93,17 @@ test_expect_success 'http-push fetches unpacked objects' '
git remote rm origin &&
git reflog expire --expire=0 --all &&
git prune &&
- git push -f -v $HTTPD_URL/test_repo_unpacked.git master)
+ git push -f -v $HTTPD_GIT_URL/test_repo_unpacked.git master)
'
test_expect_success 'http-push fetches packed objects' '
- cp -R "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
- "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_packed.git &&
+ cp -R "$HTTPD_GIT_PATH"/test_repo.git \
+ "$HTTPD_GIT_PATH"/test_repo_packed.git &&
- git clone $HTTPD_URL/test_repo_packed.git \
+ git clone $HTTPD_GIT_URL/test_repo_packed.git \
"$ROOT_PATH"/test_repo_clone_packed &&
- (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_packed.git &&
+ (cd "$HTTPD_GIT_PATH"/test_repo_packed.git &&
git --bare repack &&
git --bare prune-packed) &&
@@ -105,7 +113,7 @@ test_expect_success 'http-push fetches packed objects' '
git remote rm origin &&
git reflog expire --expire=0 --all &&
git prune &&
- git push -f -v $HTTPD_URL/test_repo_packed.git master)
+ git push -f -v $HTTPD_GIT_URL/test_repo_packed.git master)
'
test_expect_success 'create and delete remote branch' '
@@ -122,6 +130,7 @@ test_expect_success 'create and delete remote branch' '
test_must_fail git show-ref --verify refs/remotes/origin/dev
'
+test -n "$LIB_HTTPD_GIT" ||
test_expect_success 'MKCOL sends directory names with trailing slashes' '
! grep "\"MKCOL.*[^/] HTTP/[^ ]*\"" < "$HTTPD_ROOT_PATH"/access.log
@@ -134,6 +143,7 @@ x5="$x1$x1$x1$x1$x1"
x38="$x5$x5$x5$x5$x5$x5$x5$x1$x1$x1"
x40="$x38$x2"
+test -n "$LIB_HTTPD_GIT" ||
test_expect_success 'PUT and MOVE sends object to URLs with SHA-1 hash suffix' '
sed -e "s/PUT /OP /" -e "s/MOVE /OP /" "$HTTPD_ROOT_PATH"/access.log |
grep -e "\"OP .*/objects/$x2/${x38}_$x40 HTTP/[.0-9]*\" 20[0-9] "--
1.6.5.35.ge41a3