@matheusbsbs / matheus-bagliano / commits / d1a8d0ea5f
Fork 0

git-svn: fix cloning of HTTP URLs with '+' in their path

With this, git svn clone -s http://svn.gnome.org/svn/gtk+ is successful. Also modified the funky rename test for this, which _does_ include escaped '+' signs for HTTP URLs. SVN seems to accept either "+" or "%2B" in filenames and directories (just not the main URL), so I'll leave it alone for now. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Eric Wong committed May 10, 2008 at 17:14 UTC d1a8d0ea5fb2d4d43d0ea8f2fe45ec1fce7ec4bc
3 files changed +42 -4
git-svn.perl
+1 -1
@@ -3673,7 +3673,7 @@ sub escape_uri_only {
3673 my ($uri) = @_;
3674 my @tmp;
3675 foreach (split m{/}, $uri) {
3676 - s/([^\w.%-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
3676 + s/([^\w.%+-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
3677 push @tmp, $_;
3678 }
3679 join('/', @tmp);
t/lib-git-svn.sh
+7 -2
@@ -73,11 +73,16 @@ for d in \
73 done
74
75 start_httpd () {
76 + repo_base_path="$1"
77 if test -z "$SVN_HTTPD_PORT"
78 then
79 echo >&2 'SVN_HTTPD_PORT is not defined!'
80 return
81 fi
82 + if test -z "$repo_base_path"
83 + then
84 + repo_base_path=svn
85 + fi
86
87 mkdir "$GIT_DIR"/logs
88
@@ -90,13 +95,13 @@ LockFile logs/accept.lock
95 Listen 127.0.0.1:$SVN_HTTPD_PORT
96 LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so
97 LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so
93 -<Location /svn>
98 +<Location /$repo_base_path>
99 DAV svn
100 SVNPath $rawsvnrepo
101 </Location>
102 EOF
103 "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k start
99 - svnrepo=http://127.0.0.1:$SVN_HTTPD_PORT/svn
104 + svnrepo="http://127.0.0.1:$SVN_HTTPD_PORT/$repo_base_path"
105 }
106
107 stop_httpd () {
t/t9115-git-svn-dcommit-funky-renames.sh
+34 -1
@@ -9,7 +9,7 @@ test_description='git-svn dcommit can commit renames of files with ugly names'
9
10 test_expect_success 'load repository with strange names' "
11 svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
12 - start_httpd
12 + start_httpd gtk+
13 "
14
15 test_expect_success 'init and fetch repository' "
@@ -49,6 +49,39 @@ test_expect_success 'rename pretty file into ugly one' '
49 git svn dcommit
50 '
51
52 +test_expect_success 'add a file with plus signs' '
53 + echo .. > +_+ &&
54 + git update-index --add +_+ &&
55 + git commit -m plus &&
56 + mkdir gtk+ &&
57 + git mv +_+ gtk+/_+_ &&
58 + git commit -m plus_dir &&
59 + git svn dcommit
60 + '
61 +
62 +test_expect_success 'clone the repository to test rebase' "
63 + git svn clone $svnrepo test-rebase &&
64 + cd test-rebase &&
65 + echo test-rebase > test-rebase &&
66 + git add test-rebase &&
67 + git commit -m test-rebase &&
68 + cd ..
69 + "
70 +
71 +test_expect_success 'make a commit to test rebase' "
72 + echo test-rebase-main > test-rebase-main &&
73 + git add test-rebase-main &&
74 + git commit -m test-rebase-main &&
75 + git svn dcommit
76 + "
77 +
78 +test_expect_success 'git-svn rebase works inside a fresh-cloned repository' "
79 + cd test-rebase &&
80 + git svn rebase &&
81 + test -e test-rebase-main &&
82 + test -e test-rebase
83 + "
84 +
85 stop_httpd
86
87 test_done