git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make git-svn tests behave better on OS X
@ 2008-03-08 22:28 Kevin Ballard
  0 siblings, 0 replies; 9+ messages in thread
From: Kevin Ballard @ 2008-03-08 22:28 UTC (permalink / raw)
  To: git, Junio C Hamano; +Cc: Kevin Ballard

Give lib-git-svn.sh some better defaults for OS X.
Explicitly define the LockFile so httpd will actually start under OS X

Signed-off-by: Kevin Ballard <kevin@sb.org>
---
 t/lib-git-svn.sh |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 9ee35e7..1266609 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -49,8 +49,14 @@ poke() {
 	test-chmtime +1 "$1"
 }
 
-SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'}
-SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'}
+if test `uname -s` = Darwin
+then
+	SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/libexec/apache2'}
+	SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/httpd'}
+else
+	SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'}
+	SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'}
+fi
 
 start_httpd () {
 	if test -z "$SVN_HTTPD_PORT"
@@ -66,6 +72,7 @@ ServerName "git-svn test"
 ServerRoot "$GIT_DIR"
 DocumentRoot "$GIT_DIR"
 PidFile "$GIT_DIR/httpd.pid"
+LockFile logs/accept.lock
 Listen 127.0.0.1:$SVN_HTTPD_PORT
 LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so
 LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so
-- 
1.5.4.3.487.g1eab2.dirty


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH resend 1/2] Make git-svn tests behave better on OS X
@ 2008-03-20 20:08 Kevin Ballard
  2008-03-20 20:08 ` [PATCH resend 2/2] Don't try and percent-escape existing percent escapes in git-svn URIs Kevin Ballard
  2008-03-21  6:58 ` [PATCH resend 1/2] Make git-svn tests behave better on OS X Eric Wong
  0 siblings, 2 replies; 9+ messages in thread
From: Kevin Ballard @ 2008-03-20 20:08 UTC (permalink / raw)
  To: Eric Wong; +Cc: Kevin Ballard, git

Give lib-git-svn.sh some better defaults for OS X.
Explicitly define the LockFile so httpd will actually start under OS X

Signed-off-by: Kevin Ballard <kevin@sb.org>
---
 t/lib-git-svn.sh |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 9ee35e7..1266609 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -49,8 +49,14 @@ poke() {
 	test-chmtime +1 "$1"
 }
 
-SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'}
-SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'}
+if test `uname -s` = Darwin
+then
+	SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/libexec/apache2'}
+	SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/httpd'}
+else
+	SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'}
+	SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'}
+fi
 
 start_httpd () {
 	if test -z "$SVN_HTTPD_PORT"
@@ -66,6 +72,7 @@ ServerName "git-svn test"
 ServerRoot "$GIT_DIR"
 DocumentRoot "$GIT_DIR"
 PidFile "$GIT_DIR/httpd.pid"
+LockFile logs/accept.lock
 Listen 127.0.0.1:$SVN_HTTPD_PORT
 LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so
 LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so
-- 
1.5.5.rc0.10.g0fd43

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH resend 2/2] Don't try and percent-escape existing percent escapes in git-svn URIs
  2008-03-20 20:08 [PATCH resend 1/2] Make git-svn tests behave better on OS X Kevin Ballard
@ 2008-03-20 20:08 ` Kevin Ballard
  2008-03-21  6:51   ` Eric Wong
  2008-03-21  6:58 ` [PATCH resend 1/2] Make git-svn tests behave better on OS X Eric Wong
  1 sibling, 1 reply; 9+ messages in thread
From: Kevin Ballard @ 2008-03-20 20:08 UTC (permalink / raw)
  To: Eric Wong; +Cc: Kevin Ballard, git

git-svn: project names are percent-escaped ever since f5530b.
Unfortunately this breaks the scenario where the user hands git-svn
an already-escaped URI. Fix the regexp to skip over what looks like
existing percent escapes, and test this scenario.

Signed-off-by: Kevin Ballard <kevin@sb.org>
---
 git-svn.perl                                  |    2 +-
 t/t9120-git-svn-clone-with-percent-escapes.sh |   31 +++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletions(-)
 create mode 100755 t/t9120-git-svn-clone-with-percent-escapes.sh

diff --git a/git-svn.perl b/git-svn.perl
index bba22c1..0c2b791 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3665,7 +3665,7 @@ sub escape_uri_only {
 	my ($uri) = @_;
 	my @tmp;
 	foreach (split m{/}, $uri) {
-		s/([^\w.-])/sprintf("%%%02X",ord($1))/eg;
+		s/([^\w.%-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
 		push @tmp, $_;
 	}
 	join('/', @tmp);
diff --git a/t/t9120-git-svn-clone-with-percent-escapes.sh b/t/t9120-git-svn-clone-with-percent-escapes.sh
new file mode 100755
index 0000000..9a4eabe
--- /dev/null
+++ b/t/t9120-git-svn-clone-with-percent-escapes.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# Copyright (c) 2008 Kevin Ballard
+#
+
+test_description='git-svn clone with percent escapes'
+. ./lib-git-svn.sh
+
+test_expect_success 'setup svnrepo' "
+	mkdir project project/trunk project/branches project/tags &&
+	echo foo > project/trunk/foo &&
+	svn import -m '$test_description' project '$svnrepo/pr ject' &&
+	rm -rf project &&
+	start_httpd
+"
+
+if test "$SVN_HTTPD_PORT" = ""
+then
+	test_expect_failure 'test clone with percent escapes - needs SVN_HTTPD_PORT set' 'false'
+else
+	test_expect_success 'test clone with percent escapes' '
+		git svn clone "$svnrepo/pr%20ject" clone &&
+		cd clone &&
+			git rev-parse refs/remotes/git-svn &&
+		cd ..
+	'
+fi
+
+stop_httpd
+
+test_done
-- 
1.5.5.rc0.10.g0fd43

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH resend 2/2] Don't try and percent-escape existing percent escapes in git-svn URIs
  2008-03-20 20:08 ` [PATCH resend 2/2] Don't try and percent-escape existing percent escapes in git-svn URIs Kevin Ballard
@ 2008-03-21  6:51   ` Eric Wong
  2008-03-21  6:52     ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Wong @ 2008-03-21  6:51 UTC (permalink / raw)
  To: Kevin Ballard; +Cc: git

Kevin Ballard <kevin@sb.org> wrote:
> git-svn: project names are percent-escaped ever since f5530b.
> Unfortunately this breaks the scenario where the user hands git-svn
> an already-escaped URI. Fix the regexp to skip over what looks like
> existing percent escapes, and test this scenario.
> 
> Signed-off-by: Kevin Ballard <kevin@sb.org>

Acked-by: Eric Wong <normalperson@yhbt.net>

> ---
>  git-svn.perl                                  |    2 +-
>  t/t9120-git-svn-clone-with-percent-escapes.sh |   31 +++++++++++++++++++++++++
>  2 files changed, 32 insertions(+), 1 deletions(-)
>  create mode 100755 t/t9120-git-svn-clone-with-percent-escapes.sh
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index bba22c1..0c2b791 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -3665,7 +3665,7 @@ sub escape_uri_only {
>  	my ($uri) = @_;
>  	my @tmp;
>  	foreach (split m{/}, $uri) {
> -		s/([^\w.-])/sprintf("%%%02X",ord($1))/eg;
> +		s/([^\w.%-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
>  		push @tmp, $_;
>  	}
>  	join('/', @tmp);
> diff --git a/t/t9120-git-svn-clone-with-percent-escapes.sh b/t/t9120-git-svn-clone-with-percent-escapes.sh
> new file mode 100755
> index 0000000..9a4eabe
> --- /dev/null
> +++ b/t/t9120-git-svn-clone-with-percent-escapes.sh
> @@ -0,0 +1,31 @@
> +#!/bin/sh
> +#
> +# Copyright (c) 2008 Kevin Ballard
> +#
> +
> +test_description='git-svn clone with percent escapes'
> +. ./lib-git-svn.sh
> +
> +test_expect_success 'setup svnrepo' "
> +	mkdir project project/trunk project/branches project/tags &&
> +	echo foo > project/trunk/foo &&
> +	svn import -m '$test_description' project '$svnrepo/pr ject' &&
> +	rm -rf project &&
> +	start_httpd
> +"
> +
> +if test "$SVN_HTTPD_PORT" = ""
> +then
> +	test_expect_failure 'test clone with percent escapes - needs SVN_HTTPD_PORT set' 'false'
> +else
> +	test_expect_success 'test clone with percent escapes' '
> +		git svn clone "$svnrepo/pr%20ject" clone &&
> +		cd clone &&
> +			git rev-parse refs/remotes/git-svn &&
> +		cd ..
> +	'
> +fi
> +
> +stop_httpd
> +
> +test_done
> -- 
> 1.5.5.rc0.10.g0fd43

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH resend 2/2] Don't try and percent-escape existing percent escapes in git-svn URIs
  2008-03-21  6:51   ` Eric Wong
@ 2008-03-21  6:52     ` Junio C Hamano
  0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2008-03-21  6:52 UTC (permalink / raw)
  To: Eric Wong; +Cc: Kevin Ballard, git

Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH resend 1/2] Make git-svn tests behave better on OS X
  2008-03-20 20:08 [PATCH resend 1/2] Make git-svn tests behave better on OS X Kevin Ballard
  2008-03-20 20:08 ` [PATCH resend 2/2] Don't try and percent-escape existing percent escapes in git-svn URIs Kevin Ballard
@ 2008-03-21  6:58 ` Eric Wong
  2008-03-21  7:04   ` Junio C Hamano
  1 sibling, 1 reply; 9+ messages in thread
From: Eric Wong @ 2008-03-21  6:58 UTC (permalink / raw)
  To: Kevin Ballard; +Cc: git

Kevin Ballard <kevin@sb.org> wrote:
> Give lib-git-svn.sh some better defaults for OS X.
> Explicitly define the LockFile so httpd will actually start under OS X
> 
> Signed-off-by: Kevin Ballard <kevin@sb.org>

Thanks,

Acked-by: Eric Wong <normalperson@yhbt.net>

I seem to recall seeing a RHEL or CentOS machine using /usr/sbin/httpd,
somewhere, too.  Any non-Debian users care to comment/add more paths?

> ---
>  t/lib-git-svn.sh |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
> index 9ee35e7..1266609 100644
> --- a/t/lib-git-svn.sh
> +++ b/t/lib-git-svn.sh
> @@ -49,8 +49,14 @@ poke() {
>  	test-chmtime +1 "$1"
>  }
>  
> -SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'}
> -SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'}
> +if test `uname -s` = Darwin
> +then
> +	SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/libexec/apache2'}
> +	SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/httpd'}
> +else
> +	SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'}
> +	SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'}
> +fi
>  
>  start_httpd () {
>  	if test -z "$SVN_HTTPD_PORT"
> @@ -66,6 +72,7 @@ ServerName "git-svn test"
>  ServerRoot "$GIT_DIR"
>  DocumentRoot "$GIT_DIR"
>  PidFile "$GIT_DIR/httpd.pid"
> +LockFile logs/accept.lock
>  Listen 127.0.0.1:$SVN_HTTPD_PORT
>  LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so
>  LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so
> -- 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH resend 1/2] Make git-svn tests behave better on OS X
  2008-03-21  6:58 ` [PATCH resend 1/2] Make git-svn tests behave better on OS X Eric Wong
@ 2008-03-21  7:04   ` Junio C Hamano
  2008-03-21  7:27     ` [PATCH] " Kevin Ballard
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2008-03-21  7:04 UTC (permalink / raw)
  To: Eric Wong; +Cc: Kevin Ballard, git

Eric Wong <normalperson@yhbt.net> writes:

> Kevin Ballard <kevin@sb.org> wrote:
> ...
> I seem to recall seeing a RHEL or CentOS machine using /usr/sbin/httpd,
> somewhere, too.  Any non-Debian users care to comment/add more paths?
> ...
>> -SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'}
>> -SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'}
>> +if test `uname -s` = Darwin
>> +then
>> +	SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/libexec/apache2'}
>> +	SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/httpd'}
>> +else
>> +	SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'}
>> +	SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'}
>> +fi

I really hate this patch.

Why do we even _care_ about uname?

Wouldn't something like this be a lot easier to maintain in the longer run?

    for d in \
            "$SVN_HTTPD_MODULE_PATH" \
            /usr/lib/apache2/modules \
            /usr/libexec/apache2 \
    ; do
            if test -d "$d"
            then
                    SVN_HTTPD_MODULE_PATH="$d"
                    break
            fi
    done

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] Make git-svn tests behave better on OS X
  2008-03-21  7:04   ` Junio C Hamano
@ 2008-03-21  7:27     ` Kevin Ballard
  2008-03-22 19:35       ` Eric Wong
  0 siblings, 1 reply; 9+ messages in thread
From: Kevin Ballard @ 2008-03-21  7:27 UTC (permalink / raw)
  To: git, Eric Wong; +Cc: Kevin Ballard, Junio C Hamano, git

This patch works fine for me.

-->8--

Give lib-git-svn.sh a few alternate paths to look for apache2.
Explicitly define the LockFile so httpd will actually start under OS X

Signed-off-by: Kevin Ballard <kevin@sb.org>
---
 t/lib-git-svn.sh |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index 9ee35e7..9decd2e 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -49,8 +49,28 @@ poke() {
 	test-chmtime +1 "$1"
 }
 
-SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'}
-SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'}
+for d in \
+	"$SVN_HTTPD_PATH" \
+	/usr/sbin/apache2 \
+	/usr/sbin/httpd \
+; do
+	if test -f "$d"
+	then
+		SVN_HTTPD_PATH="$d"
+		break
+	fi
+done
+for d in \
+	"$SVN_HTTPD_MODULE_PATH" \
+	/usr/lib/apache2/modules \
+	/usr/libexec/apache2 \
+; do
+	if test -d "$d"
+	then
+		SVN_HTTPD_MODULE_PATH="$d"
+		break
+	fi
+done
 
 start_httpd () {
 	if test -z "$SVN_HTTPD_PORT"
@@ -66,6 +86,7 @@ ServerName "git-svn test"
 ServerRoot "$GIT_DIR"
 DocumentRoot "$GIT_DIR"
 PidFile "$GIT_DIR/httpd.pid"
+LockFile logs/accept.lock
 Listen 127.0.0.1:$SVN_HTTPD_PORT
 LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so
 LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so
-- 
1.5.5.rc0.23.gf91eb


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Make git-svn tests behave better on OS X
  2008-03-21  7:27     ` [PATCH] " Kevin Ballard
@ 2008-03-22 19:35       ` Eric Wong
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Wong @ 2008-03-22 19:35 UTC (permalink / raw)
  To: Kevin Ballard; +Cc: git, Junio C Hamano

Kevin Ballard <kevin@sb.org> wrote:
> This patch works fine for me.
> 
> -->8--
> 
> Give lib-git-svn.sh a few alternate paths to look for apache2.
> Explicitly define the LockFile so httpd will actually start under OS X
> 
> Signed-off-by: Kevin Ballard <kevin@sb.org>

Acked-by: Eric Wong <normalperson@yhbt.net>

> ---
>  t/lib-git-svn.sh |   25 +++++++++++++++++++++++--
>  1 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
> index 9ee35e7..9decd2e 100644
> --- a/t/lib-git-svn.sh
> +++ b/t/lib-git-svn.sh
> @@ -49,8 +49,28 @@ poke() {
>  	test-chmtime +1 "$1"
>  }
>  
> -SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'}
> -SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'}
> +for d in \
> +	"$SVN_HTTPD_PATH" \
> +	/usr/sbin/apache2 \
> +	/usr/sbin/httpd \
> +; do
> +	if test -f "$d"
> +	then
> +		SVN_HTTPD_PATH="$d"
> +		break
> +	fi
> +done
> +for d in \
> +	"$SVN_HTTPD_MODULE_PATH" \
> +	/usr/lib/apache2/modules \
> +	/usr/libexec/apache2 \
> +; do
> +	if test -d "$d"
> +	then
> +		SVN_HTTPD_MODULE_PATH="$d"
> +		break
> +	fi
> +done
>  
>  start_httpd () {
>  	if test -z "$SVN_HTTPD_PORT"
> @@ -66,6 +86,7 @@ ServerName "git-svn test"
>  ServerRoot "$GIT_DIR"
>  DocumentRoot "$GIT_DIR"
>  PidFile "$GIT_DIR/httpd.pid"
> +LockFile logs/accept.lock
>  Listen 127.0.0.1:$SVN_HTTPD_PORT
>  LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so
>  LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so
> -- 
> 1.5.5.rc0.23.gf91eb

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-03-22 19:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-20 20:08 [PATCH resend 1/2] Make git-svn tests behave better on OS X Kevin Ballard
2008-03-20 20:08 ` [PATCH resend 2/2] Don't try and percent-escape existing percent escapes in git-svn URIs Kevin Ballard
2008-03-21  6:51   ` Eric Wong
2008-03-21  6:52     ` Junio C Hamano
2008-03-21  6:58 ` [PATCH resend 1/2] Make git-svn tests behave better on OS X Eric Wong
2008-03-21  7:04   ` Junio C Hamano
2008-03-21  7:27     ` [PATCH] " Kevin Ballard
2008-03-22 19:35       ` Eric Wong
  -- strict thread matches above, loose matches on Subject: below --
2008-03-08 22:28 Kevin Ballard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).