Skip to content

Commit 1b42f45

Browse files
k-satodaEric Wong
authored andcommitted
git-svn: apply "svn.pathnameencoding" before URL encoding
The conversion from "svn.pathnameencoding" to UTF-8 should be applied first, and then URL encoding should be applied on the resulting UTF-8 path. The reversed order of these transforms (used before this fix) makes non-UTF-8 URL which causes error from Subversion such as "Filesystem has no item: '...' path not found" when sending a rename (or a copy) from non-ASCII path. [ew: t9115 test case added (requires SVN_HTTPD_PORT set to test), squash LC_ALL=$a_utf8_locale export from Kazutoshi for Cygwin] Signed-off-by: Kazutoshi SATODA <[email protected]> Signed-off-by: Eric Wong <[email protected]>
1 parent 40f4744 commit 1b42f45

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

perl/Git/SVN/Editor.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,12 @@ sub repo_path {
144144

145145
sub url_path {
146146
my ($self, $path) = @_;
147+
$path = $self->repo_path($path);
147148
if ($self->{url} =~ m#^https?://#) {
148149
# characters are taken from subversion/libsvn_subr/path.c
149150
$path =~ s#([^~a-zA-Z0-9_./!$&'()*+,-])#sprintf("%%%02X",ord($1))#eg;
150151
}
151-
$self->{url} . '/' . $self->repo_path($path);
152+
$self->{url} . '/' . $path;
152153
}
153154

154155
sub rmdirs {

t/t9115-git-svn-dcommit-funky-renames.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,21 @@ test_expect_success UTF8 'svn.pathnameencoding=cp932 new file on dcommit' '
104104
git svn dcommit
105105
'
106106

107+
# See the comment on the above test for setting of LC_ALL.
108+
test_expect_success 'svn.pathnameencoding=cp932 rename on dcommit' '
109+
LC_ALL=$a_utf8_locale &&
110+
export LC_ALL &&
111+
inf=$(printf "\201\207") &&
112+
git config svn.pathnameencoding cp932 &&
113+
echo inf >"$inf" &&
114+
git add "$inf" &&
115+
git commit -m "inf" &&
116+
git svn dcommit &&
117+
git mv "$inf" inf &&
118+
git commit -m "inf rename" &&
119+
git svn dcommit
120+
'
121+
107122
stop_httpd
108123

109124
test_done

0 commit comments

Comments
 (0)