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

git-svn: fix handling of even funkier branch names

Apparently do_switch() tolerates the lack of escaping in less funky branch names. For the really strange and scary ones, we need to escape them properly. It strangely maintains compatible with the existing handling of branch names with spaces and exclamation marks. Reported-by: m.skoric@web.de ($gmane/94677) Signed-off-by: Eric Wong <normalperson@yhbt.net>

Eric Wong committed Sep 6, 2008 at 20:18 UTC f4392df485b197a0797cc503b1e1a71350abfe56
2 files changed +17
git-svn.perl
+1
@@ -4025,6 +4025,7 @@ sub gs_do_switch {
4025 }
4026 }
4027 $ra ||= $self;
4028 + $url_b = escape_url($url_b);
4029 my $reporter = $ra->do_switch($rev_b, '', 1, $url_b, $editor, $pool);
4030 my @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef) : ();
4031 $reporter->set_path('', $rev_a, 0, @lock, $pool);
t/t9118-git-svn-funky-branch-names.sh
+16
@@ -6,6 +6,10 @@
6 test_description='git-svn funky branch names'
7 . ./lib-git-svn.sh
8
9 +# Abo-Uebernahme (Bug #994)
10 +scary_uri='Abo-Uebernahme%20%28Bug%20%23994%29'
11 +scary_ref='Abo-Uebernahme%20(Bug%20#994)'
12 +
13 test_expect_success 'setup svnrepo' '
14 mkdir project project/trunk project/branches project/tags &&
15 echo foo > project/trunk/foo &&
@@ -15,6 +19,8 @@ test_expect_success 'setup svnrepo' '
19 "$svnrepo/pr ject/branches/fun plugin" &&
20 svn cp -m "more fun!" "$svnrepo/pr ject/branches/fun plugin" \
21 "$svnrepo/pr ject/branches/more fun plugin!" &&
22 + svn cp -m "scary" "$svnrepo/pr ject/branches/fun plugin" \
23 + "$svnrepo/pr ject/branches/$scary_uri" &&
24 start_httpd
25 '
26
@@ -23,6 +29,7 @@ test_expect_success 'test clone with funky branch names' '
29 cd project &&
30 git rev-parse "refs/remotes/fun%20plugin" &&
31 git rev-parse "refs/remotes/more%20fun%20plugin!" &&
32 + git rev-parse "refs/remotes/$scary_ref" &&
33 cd ..
34 '
35
@@ -35,6 +42,15 @@ test_expect_success 'test dcommit to funky branch' "
42 cd ..
43 "
44
45 +test_expect_success 'test dcommit to scary branch' '
46 + cd project &&
47 + git reset --hard "refs/remotes/$scary_ref" &&
48 + echo urls are scary >> foo &&
49 + git commit -m "eep" -- foo &&
50 + git svn dcommit &&
51 + cd ..
52 + '
53 +
54 stop_httpd
55
56 test_done