threads / discuss / 21349

Smart HTTP tests

Subject: Smart HTTP tests

## tl;dr

9 messages between Oct 25, 2009 and Oct 28, 2009.

replies: 8people: 3as markdown or json

Clemens Buchacher· Oct 25, 2009, 12:06 UTC · lore
Hi Shawn,
This is on top of 1e0eb0f0 (Smart HTTP fetch: gzip requests) in pu.

I had to use the SetHandler syntax as suggested by Mark. My apache setup (debian 2.2.9-10+lenny) does not resolve the suffix to git-http-backend relative to document root automatically. Instead it will look for repos in ${GIT_EXEC_PATH}/git-http-backend/git/...

Clemens
Clemens Buchacher· Oct 25, 2009, 12:06 UTC · re: Clemens Buchacher · lore

[PATCH 1/3] update http tests according to remote-curl capabilities

 o Pushing packed refs is now fixed.
 o The transport helper fails if refs are already up-to-date. Add a
   test for that.
 o The transport helper will notice if refs are already up-to-date. We
   therefore need to update server info in the unpacked-refs test.
 o The transport helper will purge deleted branches automatically.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---
 t/t5540-http-push.sh |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index f4a2cf6..09edd23 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -36,6 +36,7 @@ test_expect_success 'setup remote repository' '
 	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"
 '
@@ -45,7 +46,7 @@ test_expect_success 'clone remote repository' '
 	git clone $HTTPD_URL/test_repo.git test_repo_clone
 '
 
-test_expect_failure 'push to remote repository with packed refs' '
+test_expect_success 'push to remote repository with packed refs' '
 	cd "$ROOT_PATH"/test_repo_clone &&
 	: >path2 &&
 	git add path2 &&
@@ -57,11 +58,15 @@ test_expect_failure 'push to remote repository with packed refs' '
 	 test $HEAD = $(git rev-parse --verify HEAD))
 '
 
-test_expect_success ' push to remote repository with unpacked refs' '
+test_expect_failure 'push already up-to-date' '
+	git push
+'
+
+test_expect_success 'push to remote repository with unpacked refs' '
 	(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
 	 rm packed-refs &&
-	 git update-ref refs/heads/master \
-		0c973ae9bd51902a28466f3850b543fa66a6aaf4) &&
+	 git update-ref refs/heads/master $ORIG_HEAD &&
+	 git --bare update-server-info) &&
 	git push &&
 	(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&
 	 test $HEAD = $(git rev-parse --verify HEAD))
@@ -113,7 +118,6 @@ test_expect_success 'create and delete remote branch' '
 	git push origin dev &&
 	git fetch &&
 	git push origin :dev &&
-	git branch -d -r origin/dev &&
 	git fetch &&
 	test_must_fail git show-ref --verify refs/remotes/origin/dev
 '
-- 
1.6.5.35.ge41a3
Clemens Buchacher· Oct 25, 2009, 12:06 UTC · re: Clemens Buchacher · lore

[PATCH 2/3] remote-helpers: return successfully if everything up-to-date

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---
 t/t5540-http-push.sh |    2 +-
 transport-helper.c   |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index 09edd23..2ece661 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -58,7 +58,7 @@ test_expect_success 'push to remote repository with packed refs' '
 	 test $HEAD = $(git rev-parse --verify HEAD))
 '
 
-test_expect_failure 'push already up-to-date' '
+test_expect_success 'push already up-to-date' '
 	git push
 '
 
diff --git a/transport-helper.c b/transport-helper.c
index 16c6641..5078c71 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -263,6 +263,8 @@ static int push_refs(struct transport *transport,
 		strbuf_addstr(&buf, ref->name);
 		strbuf_addch(&buf, '\n');
 	}
+	if (buf.len == 0)
+		return 0;
 
 	transport->verbose = flags & TRANSPORT_PUSH_VERBOSE ? 1 : 0;
 	standard_options(transport);
-- 
1.6.5.35.ge41a3
Clemens Buchacher· Oct 25, 2009, 12:06 UTC · re: Clemens Buchacher · lore

[PATCH 3/3] add smart HTTP tests

Set LIB_HTTPD_GIT to enable smart HTTP tests.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---
 t/lib-httpd.sh          |    9 +++++++++
 t/lib-httpd/apache.conf |   36 +++++++++++++++++++++++++++---------
 t/t5540-http-push.sh    |   46 ++++++++++++++++++++++++++++------------------
 3 files changed, 64 insertions(+), 27 deletions(-)
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
Shawn O. Pearce· Oct 28, 2009, 00:17 UTC · re: Clemens Buchacher · lore

Re: [PATCH 3/3] add smart HTTP tests

Clemens Buchacher <drizzd@aon.at> wrote:
> Set LIB_HTTPD_GIT to enable smart HTTP tests.

My concern here is we have to run the test suite twice in order to test HTTP support. We should only run it once, with GIT_TEST_HTTPD=1 set and have it all run at once.

-- 
Shawn.
Clemens Buchacher· Oct 28, 2009, 17:52 UTC · re: Shawn O. Pearce · lore

[PATCH] t5540: test both smart and dumb protocols

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---
On Tue, Oct 27, 2009 at 05:17:38PM -0700, Shawn O. Pearce wrote:
Show 6 quoted lines
> Clemens Buchacher <drizzd@aon.at> wrote:
> > Set LIB_HTTPD_GIT to enable smart HTTP tests.
> 
> My concern here is we have to run the test suite twice in order to
> test HTTP support.  We should only run it once, with GIT_TEST_HTTPD=1
> set and have it all run at once.

How about this? The original code is not touched except for the test description.

Clemens
 t/lib-httpd.sh       |    2 +
 t/t5540-http-push.sh |  160 ++-----------------------------------------------
 t/test-http-push.sh  |  159 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 168 insertions(+), 153 deletions(-)
 create mode 100755 t/test-http-push.sh
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index aaa0a71..cf1f1df 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -121,4 +121,6 @@ stop_httpd() {
 
 	"$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
 		-f "$TEST_PATH/apache.conf" $HTTPD_PARA -k stop
+
+	rm -f "$HTTPD_ROOT_PATH/modules"
 }
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index 049e129..a156f37 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -1,155 +1,9 @@
 #!/bin/sh
-#
-# Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
-#
 
-test_description='test http-push
-
-This test runs various sanity checks on http-push.'
-
-. ./test-lib.sh
-
-ROOT_PATH="$PWD"
-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 ]
-then
-	say "skipping test, USE_CURL_MULTI is not defined"
-	test_done
-fi
-
-. "$TEST_DIRECTORY"/lib-httpd.sh
-start_httpd
-
-test_expect_success 'setup remote repository' '
-	cd "$ROOT_PATH" &&
-	mkdir test_repo &&
-	cd test_repo &&
-	git init &&
-	: >path1 &&
-	git add path1 &&
-	test_tick &&
-	git commit -m initial &&
-	cd - &&
-	git clone --bare test_repo test_repo.git &&
-	cd test_repo.git &&
-	ORIG_HEAD=$(git rev-parse --verify HEAD) &&
-	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_GIT_URL/test_repo.git test_repo_clone
-'
-
-test_expect_success 'push to remote repository with packed refs' '
-	cd "$ROOT_PATH"/test_repo_clone &&
-	: >path2 &&
-	git add path2 &&
-	test_tick &&
-	git commit -m path2 &&
-	HEAD=$(git rev-parse --verify HEAD) &&
-	git push &&
-	(cd "$HTTPD_GIT_PATH"/test_repo.git &&
-	 test $HEAD = $(git rev-parse --verify HEAD))
-'
-
-test_expect_success 'push already up-to-date' '
-	git push
-'
-
-test_expect_success 'push to remote repository with unpacked refs' '
-	(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_GIT_PATH"/test_repo.git &&
-	 test $HEAD = $(git rev-parse --verify HEAD))
-'
-
-test_expect_success 'http-push fetches unpacked objects' '
-	cp -R "$HTTPD_GIT_PATH"/test_repo.git \
-		"$HTTPD_GIT_PATH"/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
-	(cd "$ROOT_PATH"/fetch_unpacked &&
-	 git reset --hard HEAD^ &&
-	 git remote rm origin &&
-	 git reflog expire --expire=0 --all &&
-	 git prune &&
-	 git push -f -v $HTTPD_GIT_URL/test_repo_unpacked.git master)
-'
-
-test_expect_success 'http-push fetches packed objects' '
-	cp -R "$HTTPD_GIT_PATH"/test_repo.git \
-		"$HTTPD_GIT_PATH"/test_repo_packed.git &&
-
-	git clone $HTTPD_GIT_URL/test_repo_packed.git \
-		"$ROOT_PATH"/test_repo_clone_packed &&
-
-	(cd "$HTTPD_GIT_PATH"/test_repo_packed.git &&
-	 git --bare repack &&
-	 git --bare prune-packed) &&
-
-	# By reset, we force git to retrieve the packed object
-	(cd "$ROOT_PATH"/test_repo_clone_packed &&
-	 git reset --hard HEAD^ &&
-	 git remote rm origin &&
-	 git reflog expire --expire=0 --all &&
-	 git prune &&
-	 git push -f -v $HTTPD_GIT_URL/test_repo_packed.git master)
-'
-
-test_expect_success 'create and delete remote branch' '
-	cd "$ROOT_PATH"/test_repo_clone &&
-	git checkout -b dev &&
-	: >path3 &&
-	git add path3 &&
-	test_tick &&
-	git commit -m dev &&
-	git push origin dev &&
-	git fetch &&
-	git push origin :dev &&
-	git fetch &&
-	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
-
-'
-
-x1="[0-9a-f]"
-x2="$x1$x1"
-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] "
-
-'
-
-stop_httpd
-
-test_done
+LIB_HTTPD_GIT=t
+export LIB_HTTPD_GIT
+./test-http-push.sh $@
+sleep 1
+LIB_HTTPD_GIT=
+export LIB_HTTPD_GIT
+./test-http-push.sh $@
diff --git a/t/test-http-push.sh b/t/test-http-push.sh
new file mode 100755
index 0000000..c557541
--- /dev/null
+++ b/t/test-http-push.sh
@@ -0,0 +1,159 @@
+#!/bin/sh
+
+if test -n "$LIB_HTTPD_GIT"
+then
+	protocol=smart
+else
+	protocol=dumb
+fi
+
+test_description="test http-push ($protocol)
+
+This test runs various sanity checks on http-push."
+
+. ./test-lib.sh
+
+ROOT_PATH="$PWD"
+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 ]
+then
+	say "skipping test, USE_CURL_MULTI is not defined"
+	test_done
+fi
+
+. "$TEST_DIRECTORY"/lib-httpd.sh
+start_httpd
+
+test_expect_success 'setup remote repository' '
+	cd "$ROOT_PATH" &&
+	mkdir test_repo &&
+	cd test_repo &&
+	git init &&
+	: >path1 &&
+	git add path1 &&
+	test_tick &&
+	git commit -m initial &&
+	cd - &&
+	git clone --bare test_repo test_repo.git &&
+	cd test_repo.git &&
+	ORIG_HEAD=$(git rev-parse --verify HEAD) &&
+	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_GIT_URL/test_repo.git test_repo_clone
+'
+
+test_expect_success 'push to remote repository with packed refs' '
+	cd "$ROOT_PATH"/test_repo_clone &&
+	: >path2 &&
+	git add path2 &&
+	test_tick &&
+	git commit -m path2 &&
+	HEAD=$(git rev-parse --verify HEAD) &&
+	git push &&
+	(cd "$HTTPD_GIT_PATH"/test_repo.git &&
+	 test $HEAD = $(git rev-parse --verify HEAD))
+'
+
+test_expect_success 'push already up-to-date' '
+	git push
+'
+
+test_expect_success 'push to remote repository with unpacked refs' '
+	(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_GIT_PATH"/test_repo.git &&
+	 test $HEAD = $(git rev-parse --verify HEAD))
+'
+
+test_expect_success 'http-push fetches unpacked objects' '
+	cp -R "$HTTPD_GIT_PATH"/test_repo.git \
+		"$HTTPD_GIT_PATH"/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
+	(cd "$ROOT_PATH"/fetch_unpacked &&
+	 git reset --hard HEAD^ &&
+	 git remote rm origin &&
+	 git reflog expire --expire=0 --all &&
+	 git prune &&
+	 git push -f -v $HTTPD_GIT_URL/test_repo_unpacked.git master)
+'
+
+test_expect_success 'http-push fetches packed objects' '
+	cp -R "$HTTPD_GIT_PATH"/test_repo.git \
+		"$HTTPD_GIT_PATH"/test_repo_packed.git &&
+
+	git clone $HTTPD_GIT_URL/test_repo_packed.git \
+		"$ROOT_PATH"/test_repo_clone_packed &&
+
+	(cd "$HTTPD_GIT_PATH"/test_repo_packed.git &&
+	 git --bare repack &&
+	 git --bare prune-packed) &&
+
+	# By reset, we force git to retrieve the packed object
+	(cd "$ROOT_PATH"/test_repo_clone_packed &&
+	 git reset --hard HEAD^ &&
+	 git remote rm origin &&
+	 git reflog expire --expire=0 --all &&
+	 git prune &&
+	 git push -f -v $HTTPD_GIT_URL/test_repo_packed.git master)
+'
+
+test_expect_success 'create and delete remote branch' '
+	cd "$ROOT_PATH"/test_repo_clone &&
+	git checkout -b dev &&
+	: >path3 &&
+	git add path3 &&
+	test_tick &&
+	git commit -m dev &&
+	git push origin dev &&
+	git fetch &&
+	git push origin :dev &&
+	git fetch &&
+	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
+
+'
+
+x1="[0-9a-f]"
+x2="$x1$x1"
+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] "
+
+'
+
+stop_httpd
+
+test_done
-- 
1.6.5.1.208.gd7b37
Shawn O. Pearce· Oct 28, 2009, 00:11 UTC · re: Clemens Buchacher · lore

Re: [PATCH 2/3] remote-helpers: return successfully if everything up-to-date

Clemens Buchacher <drizzd@aon.at> wrote:
> 
> Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
>  t/t5540-http-push.sh |    2 +-
>  transport-helper.c   |    2 ++
>  2 files changed, 3 insertions(+), 1 deletions(-)
-- 
Shawn.
Shawn O. Pearce· Oct 28, 2009, 00:10 UTC · re: Clemens Buchacher · lore

Re: [PATCH 1/3] update http tests according to remote-curl capabilities

Clemens Buchacher <drizzd@aon.at> wrote:
Show 11 quoted lines
>  o Pushing packed refs is now fixed.
> 
>  o The transport helper fails if refs are already up-to-date. Add a
>    test for that.
> 
>  o The transport helper will notice if refs are already up-to-date. We
>    therefore need to update server info in the unpacked-refs test.
> 
>  o The transport helper will purge deleted branches automatically.
> 
> Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
>  t/t5540-http-push.sh |   14 +++++++++-----
>  1 files changed, 9 insertions(+), 5 deletions(-)
-- 
Shawn.

← back to recent threads