git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 3/3] git-svn: apply "svn.pathnameencoding" before URL encoding

From
EWEric Wong <normalperson@yhbt.net>
Date
Feb 22, 2016, 02:55 UTC
Message-ID
<1456109711-26866-4-git-send-email-normalperson@yhbt.net>
In-Reply-To
<1456109711-26866-1-git-send-email-normalperson@yhbt.net>
From: Kazutoshi Satoda <k_satoda@f2.dion.ne.jp>

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                   |  3 ++-
 t/t9115-git-svn-dcommit-funky-renames.sh | 15 +++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/perl/Git/SVN/Editor.pm b/perl/Git/SVN/Editor.pm
index d9d9bdf..4c4199a 100644
--- a/perl/Git/SVN/Editor.pm
+++ b/perl/Git/SVN/Editor.pm
@@ -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 {
diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh
index a3927c4..0990f8d 100755
--- a/t/t9115-git-svn-dcommit-funky-renames.sh
+++ b/t/t9115-git-svn-dcommit-funky-renames.sh
@@ -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
-- 
EW
Previous: Eric WongNext: Junio C Hamano
Message 4 of 5 in “git-svn: svn.pathnameencoding for dcommit”
  1. 0/3 git-svn: svn.pathnameencoding for dcommitEric Wong, Feb 22, 2016
  2. 1/3 git-svn: hoist out utf8 prep from t9129 to lib-git-svnEric Wong, Feb 22, 2016
  3. 2/3 git-svn: enable "svn.pathnameencoding" on dcommitEric Wong, Feb 22, 2016
  4. 3/3 git-svn: apply "svn.pathnameencoding" before URL encodingEric Wong, Feb 22, 2016
  5. Junio C HamanoFeb 22, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.