Skip to content

Commit 40f4744

Browse files
k-satodaEric Wong
authored andcommitted
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>
1 parent 3df0d26 commit 40f4744

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

perl/Git/SVN/Editor.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ sub new {
4141
"$self->{svn_path}/" : '';
4242
$self->{config} = $opts->{config};
4343
$self->{mergeinfo} = $opts->{mergeinfo};
44+
$self->{pathnameencoding} = Git::config('svn.pathnameencoding');
4445
return $self;
4546
}
4647

t/t9115-git-svn-dcommit-funky-renames.sh

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,32 @@ test_expect_success 'make a commit to test rebase' '
7777
'
7878

7979
test_expect_success 'git svn rebase works inside a fresh-cloned repository' '
80-
cd test-rebase &&
80+
(
81+
cd test-rebase &&
8182
git svn rebase &&
8283
test -e test-rebase-main &&
8384
test -e test-rebase
84-
'
85+
)'
86+
87+
# Without this, LC_ALL=C as set in test-lib.sh, and Cygwin converts
88+
# non-ASCII characters in filenames unexpectedly, and causes errors.
89+
# https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars
90+
# > Some characters are disallowed in filenames on Windows filesystems. ...
91+
# ...
92+
# > ... All of the above characters, except for the backslash, are converted
93+
# > to special UNICODE characters in the range 0xf000 to 0xf0ff (the
94+
# > "Private use area") when creating or accessing files.
95+
prepare_a_utf8_locale
96+
test_expect_success UTF8 'svn.pathnameencoding=cp932 new file on dcommit' '
97+
LC_ALL=$a_utf8_locale &&
98+
export LC_ALL &&
99+
neq=$(printf "\201\202") &&
100+
git config svn.pathnameencoding cp932 &&
101+
echo neq >"$neq" &&
102+
git add "$neq" &&
103+
git commit -m "neq" &&
104+
git svn dcommit
105+
'
85106

86107
stop_httpd
87108

0 commit comments

Comments
 (0)