git-svn: enable "svn.pathnameencoding" on dcommit

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>
This commit is contained in:
Kazutoshi Satoda 2016-02-09 00:20:31 +09:00 committed by Eric Wong
parent 3df0d26ca6
commit 40f47448a9
2 changed files with 24 additions and 2 deletions

View 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;
}

View File

@ -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