]> granicus.if.org Git - git/commitdiff
git-svn: enable "svn.pathnameencoding" on dcommit
authorKazutoshi Satoda <k_satoda@f2.dion.ne.jp>
Mon, 8 Feb 2016 15:20:31 +0000 (00:20 +0900)
committerEric Wong <normalperson@yhbt.net>
Mon, 22 Feb 2016 02:28:34 +0000 (02:28 +0000)
Without the initialization of $self->{pathnameencoding}, conversion in
repo_path() is always skipped as $self->{pathnameencoding} is undefined
even if "svn.pathnameencoding" is configured.

The lack of conversion results in mysterious failure of dcommit (e.g.
"Malformed XML") which happen only when a commit involves a change on
non-ASCII path.

[ew: add test case to t9115,
 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 c50176eec9418c50e5c63921c24e76a87b6123ab..d9d9bdf3319072f17c2fb0ec3cff9d50a4750fc7 100644 (file)
@@ -41,6 +41,7 @@ sub new {
                               "$self->{svn_path}/" : '';
        $self->{config} = $opts->{config};
        $self->{mergeinfo} = $opts->{mergeinfo};
+       $self->{pathnameencoding} = Git::config('svn.pathnameencoding');
        return $self;
 }
 
index 6a48e4042996549e40843186783e2215beee9cca..a3927c46ba5a3163f0dc10f911581a5bef4a12e6 100755 (executable)
@@ -77,11 +77,32 @@ test_expect_success 'make a commit to test rebase' '
        '
 
 test_expect_success 'git svn rebase works inside a fresh-cloned repository' '
-       cd test-rebase &&
+       (
+               cd test-rebase &&
                git svn rebase &&
                test -e test-rebase-main &&
                test -e test-rebase
-       '
+       )'
+
+# Without this, LC_ALL=C as set in test-lib.sh, and Cygwin converts
+# non-ASCII characters in filenames unexpectedly, and causes errors.
+# https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars
+# > Some characters are disallowed in filenames on Windows filesystems. ...
+# ...
+# > ... All of the above characters, except for the backslash, are converted
+# > to special UNICODE characters in the range 0xf000 to 0xf0ff (the
+# > "Private use area") when creating or accessing files.
+prepare_a_utf8_locale
+test_expect_success UTF8 'svn.pathnameencoding=cp932 new file on dcommit' '
+       LC_ALL=$a_utf8_locale &&
+       export LC_ALL &&
+       neq=$(printf "\201\202") &&
+       git config svn.pathnameencoding cp932 &&
+       echo neq >"$neq" &&
+       git add "$neq" &&
+       git commit -m "neq" &&
+       git svn dcommit
+'
 
 stop_httpd