]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-svn: apply "svn.pathnameencoding" before URL encoding
authorKazutoshi Satoda <k_satoda@f2.dion.ne.jp>
Mon, 8 Feb 2016 15:21:02 +0000 (00:21 +0900)
committerEric Wong <normalperson@yhbt.net>
Mon, 22 Feb 2016 02:29:36 +0000 (02:29 +0000)
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 <k_satoda@f2.dion.ne.jp>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
perl/Git/SVN/Editor.pm
t/t9115-git-svn-dcommit-funky-renames.sh

index d9d9bdf3319072f17c2fb0ec3cff9d50a4750fc7..4c4199afecac2c5fc6d918cf0d3b75449504b808 100644 (file)
@@ -144,11 +144,12 @@ sub repo_path {
 
 sub url_path {
        my ($self, $path) = @_;
+       $path = $self->repo_path($path);
        if ($self->{url} =~ m#^https?://#) {
                # characters are taken from subversion/libsvn_subr/path.c
                $path =~ s#([^~a-zA-Z0-9_./!$&'()*+,-])#sprintf("%%%02X",ord($1))#eg;
        }
-       $self->{url} . '/' . $self->repo_path($path);
+       $self->{url} . '/' . $path;
 }
 
 sub rmdirs {
index a3927c46ba5a3163f0dc10f911581a5bef4a12e6..0990f8d23571878fccb6e3607caa938590e3f683 100755 (executable)
@@ -104,6 +104,21 @@ test_expect_success UTF8 'svn.pathnameencoding=cp932 new file on dcommit' '
        git svn dcommit
 '
 
+# See the comment on the above test for setting of LC_ALL.
+test_expect_success 'svn.pathnameencoding=cp932 rename on dcommit' '
+       LC_ALL=$a_utf8_locale &&
+       export LC_ALL &&
+       inf=$(printf "\201\207") &&
+       git config svn.pathnameencoding cp932 &&
+       echo inf >"$inf" &&
+       git add "$inf" &&
+       git commit -m "inf" &&
+       git svn dcommit &&
+       git mv "$inf" inf &&
+       git commit -m "inf rename" &&
+       git svn dcommit
+'
+
 stop_httpd
 
 test_done