Skip to content

Commit

Permalink
git-svn: enable "svn.pathnameencoding" on dcommit
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Eric Wong <[email protected]>
  • Loading branch information
k-satoda authored and Eric Wong committed Feb 22, 2016
1 parent 3df0d26 commit 40f4744
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions perl/Git/SVN/Editor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
25 changes: 23 additions & 2 deletions t/t9115-git-svn-dcommit-funky-renames.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 40f4744

Please sign in to comment.