Skip to content

Commit f4392df

Browse files
author
Eric Wong
committed
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>
1 parent 7c4d021 commit f4392df

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

git-svn.perl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4025,6 +4025,7 @@ sub gs_do_switch {
40254025
}
40264026
}
40274027
$ra ||= $self;
4028+
$url_b = escape_url($url_b);
40284029
my $reporter = $ra->do_switch($rev_b, '', 1, $url_b, $editor, $pool);
40294030
my @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef) : ();
40304031
$reporter->set_path('', $rev_a, 0, @lock, $pool);

t/t9118-git-svn-funky-branch-names.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
test_description='git-svn funky branch names'
77
. ./lib-git-svn.sh
88

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+
913
test_expect_success 'setup svnrepo' '
1014
mkdir project project/trunk project/branches project/tags &&
1115
echo foo > project/trunk/foo &&
@@ -15,6 +19,8 @@ test_expect_success 'setup svnrepo' '
1519
"$svnrepo/pr ject/branches/fun plugin" &&
1620
svn cp -m "more fun!" "$svnrepo/pr ject/branches/fun plugin" \
1721
"$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" &&
1824
start_httpd
1925
'
2026

@@ -23,6 +29,7 @@ test_expect_success 'test clone with funky branch names' '
2329
cd project &&
2430
git rev-parse "refs/remotes/fun%20plugin" &&
2531
git rev-parse "refs/remotes/more%20fun%20plugin!" &&
32+
git rev-parse "refs/remotes/$scary_ref" &&
2633
cd ..
2734
'
2835

@@ -35,6 +42,15 @@ test_expect_success 'test dcommit to funky branch' "
3542
cd ..
3643
"
3744

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+
3854
stop_httpd
3955

4056
test_done

0 commit comments

Comments
 (0)