# [PATCH] Fix http-push test

5 messages from 2008-07-07 to 2008-07-07. Participants: Mike Hommey, Junio C Hamano.
Thread: https://gitlist.dev/t/14327

## Mike Hommey, 2008-07-07 19:02

Subject: [PATCH] Fix http-push test
Message-ID: <1215457357-24279-1-git-send-email-mh@glandium.org>
URL: https://gitlist.dev/e/1215457357-24279-1-git-send-email-mh%40glandium.org

```
http-push test has been broken by 4a7aaccd adding a space character
in the place where the test is being run.
---

 Note that the 4th test doesn't pass because of the new git clone, that
 creates the clone with packed-refs instead of refs/heads/master that
 push is requiring. But this also means push was already broken with
 repositories with packed-refs.

 t/lib-httpd.sh       |   18 ++++++++++--------
 t/t5540-http-push.sh |    2 +-
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index a5c4436..dc473df 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -45,22 +45,22 @@ else
 	error "Could not identify web server at '$LIB_HTTPD_PATH'"
 fi
 
-HTTPD_PARA="-d $HTTPD_ROOT_PATH -f $TEST_PATH/apache.conf"
+HTTPD_PARA=""
 
 prepare_httpd() {
-	mkdir -p $HTTPD_DOCUMENT_ROOT_PATH
+	mkdir -p "$HTTPD_DOCUMENT_ROOT_PATH"
 
-	ln -s $LIB_HTTPD_MODULE_PATH $HTTPD_ROOT_PATH/modules
+	ln -s "$LIB_HTTPD_MODULE_PATH" "$HTTPD_ROOT_PATH/modules"
 
 	if test -n "$LIB_HTTPD_SSL"
 	then
 		HTTPD_URL=https://127.0.0.1:$LIB_HTTPD_PORT
 
 		RANDFILE_PATH="$HTTPD_ROOT_PATH"/.rnd openssl req \
-			-config $TEST_PATH/ssl.cnf \
+			-config "$TEST_PATH/ssl.cnf" \
 			-new -x509 -nodes \
-			-out $HTTPD_ROOT_PATH/httpd.pem \
-			-keyout $HTTPD_ROOT_PATH/httpd.pem
+			-out "$HTTPD_ROOT_PATH/httpd.pem" \
+			-keyout "$HTTPD_ROOT_PATH/httpd.pem"
 		GIT_SSL_NO_VERIFY=t
 		export GIT_SSL_NO_VERIFY
 		HTTPD_PARA="$HTTPD_PARA -DSSL"
@@ -86,12 +86,14 @@ start_httpd() {
 
 	trap 'stop_httpd; die' exit
 
-	"$LIB_HTTPD_PATH" $HTTPD_PARA \
+	"$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
+		-f "$TEST_PATH/apache.conf" $HTTPD_PARA \
 		-c "Listen 127.0.0.1:$LIB_HTTPD_PORT" -k start
 }
 
 stop_httpd() {
 	trap 'die' exit
 
-	"$LIB_HTTPD_PATH" $HTTPD_PARA -k stop
+	"$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
+		-f "$TEST_PATH/apache.conf" -k stop
 }
diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index f15dd03..6cd8b45 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -36,7 +36,7 @@ test_expect_success 'setup remote repository' '
 	git --bare update-server-info &&
 	chmod +x hooks/post-update &&
 	cd - &&
-	mv test_repo.git $HTTPD_DOCUMENT_ROOT_PATH
+	mv test_repo.git "$HTTPD_DOCUMENT_ROOT_PATH"
 '
 
 test_expect_success 'clone remote repository' '
-- 
1.5.6.2.220.g44701

```

## Mike Hommey, 2008-07-07 19:08

Subject: Re: [PATCH] Fix http-push test
Message-ID: <20080707190847.GA24489@glandium.org>
URL: https://gitlist.dev/e/20080707190847.GA24489%40glandium.org
In-Reply-To: <1215457357-24279-1-git-send-email-mh@glandium.org>

```
On Mon, Jul 07, 2008 at 09:02:37PM +0200, Mike Hommey wrote:
> http-push test has been broken by 4a7aaccd adding a space character
> in the place where the test is being run.
> ---
> 
>  Note that the 4th test doesn't pass because of the new git clone, that
>  creates the clone with packed-refs instead of refs/heads/master that
>  push is requiring. But this also means push was already broken with
>  repositories with packed-refs.

Actually, the 3rd is failing too, but fails to report an error because
git push returns no error code in cases where it says:
  No refs in common and none specified; doing nothing.

Mike

```

## Junio C Hamano, 2008-07-07 19:54

Subject: Re: [PATCH] Fix http-push test
Message-ID: <7vej6531xa.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vej6531xa.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20080707190847.GA24489@glandium.org>

```
Mike Hommey <mh@glandium.org> writes:

> On Mon, Jul 07, 2008 at 09:02:37PM +0200, Mike Hommey wrote:
>> http-push test has been broken by 4a7aaccd adding a space character
>> in the place where the test is being run.
>> ---
>> 
>>  Note that the 4th test doesn't pass because of the new git clone, that
>>  creates the clone with packed-refs instead of refs/heads/master that
>>  push is requiring. But this also means push was already broken with
>>  repositories with packed-refs.
>
> Actually, the 3rd is failing too, but fails to report an error because
> git push returns no error code in cases where it says:
>   No refs in common and none specified; doing nothing.

Ok, when you are done checking, care to send in a replacement patch with
failing one marked with test_expect_failure?

You do not have to hurry, I am currently at day job and already deep in
today's integration cycle during the lunchtime, and won't be able to queue
new fixes for several hours from now, so your patch will be part of
tomorrow's or tonight's cycle anyway.

```

## Mike Hommey, 2008-07-07 20:17

Subject: Re: [PATCH] Fix http-push test
Message-ID: <20080707201720.GA1356@glandium.org>
URL: https://gitlist.dev/e/20080707201720.GA1356%40glandium.org
In-Reply-To: <7vej6531xa.fsf@gitster.siamese.dyndns.org>

```
On Mon, Jul 07, 2008 at 12:54:41PM -0700, Junio C Hamano wrote:
> Mike Hommey <mh@glandium.org> writes:
> 
> > On Mon, Jul 07, 2008 at 09:02:37PM +0200, Mike Hommey wrote:
> >> http-push test has been broken by 4a7aaccd adding a space character
> >> in the place where the test is being run.
> >> ---
> >> 
> >>  Note that the 4th test doesn't pass because of the new git clone, that
> >>  creates the clone with packed-refs instead of refs/heads/master that
> >>  push is requiring. But this also means push was already broken with
> >>  repositories with packed-refs.
> >
> > Actually, the 3rd is failing too, but fails to report an error because
> > git push returns no error code in cases where it says:
> >   No refs in common and none specified; doing nothing.
> 
> Ok, when you are done checking, care to send in a replacement patch with
> failing one marked with test_expect_failure?

Shouldn't that be two different patches ? One to fix the spaces problem
and one to handle the fact that builtin-clone broke the tests ?

Mike

```

## Mike Hommey, 2008-07-07 21:06

Subject: [PATCH] Catch failures from t5540-http-push
Message-ID: <1215464806-5412-1-git-send-email-mh@glandium.org>
URL: https://gitlist.dev/e/1215464806-5412-1-git-send-email-mh%40glandium.org
In-Reply-To: <7vej6531xa.fsf@gitster.siamese.dyndns.org>

```
git http-push doesn't handle packed-refs, and now the new builtin-clone
created packed refs, the http-push test fails.

Mark the current failure as such, and also catch third test's failure
that went unreported because git push doesn't return an error code when
it says:
 No refs in common and none specified; doing nothing.
Which it does when http-push can't get a list of refs recursively from
$URL/refs/.

Signed-off-by: Mike Hommey <mh@glandium.org>
---

 Feel free to squash this in the previous one, if you feel it's better.

 t/t5540-http-push.sh |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh
index 147ff98..21dbb55 100755
--- a/t/t5540-http-push.sh
+++ b/t/t5540-http-push.sh
@@ -51,16 +51,17 @@ test_expect_success 'clone remote repository' '
 	git clone $HTTPD_URL/test_repo.git test_repo_clone
 '
 
-test_expect_success 'push to remote repository' '
+test_expect_failure 'push to remote repository' '
 	cd "$ROOT_PATH"/test_repo_clone &&
 	: >path2 &&
 	git add path2 &&
 	test_tick &&
 	git commit -m path2 &&
-	git push
+	git push &&
+	[ -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/refs/heads/master" ]
 '
 
-test_expect_success 'create and delete remote branch' '
+test_expect_failure 'create and delete remote branch' '
 	cd "$ROOT_PATH"/test_repo_clone &&
 	git checkout -b dev &&
 	: >path3 &&
-- 
1.5.6.GIT

```
