Merge branch 'ks/svn-pathnameencoding-4' of git://git.bogomips.org/git-svn
* 'ks/svn-pathnameencoding-4' of git://git.bogomips.org/git-svn: git-svn: apply "svn.pathnameencoding" before URL encoding git-svn: enable "svn.pathnameencoding" on dcommit git-svn: hoist out utf8 prep from t9129 to lib-git-svn
This commit is contained in:
commit
d4bd6781de
@ -41,6 +41,7 @@ sub new {
|
|||||||
"$self->{svn_path}/" : '';
|
"$self->{svn_path}/" : '';
|
||||||
$self->{config} = $opts->{config};
|
$self->{config} = $opts->{config};
|
||||||
$self->{mergeinfo} = $opts->{mergeinfo};
|
$self->{mergeinfo} = $opts->{mergeinfo};
|
||||||
|
$self->{pathnameencoding} = Git::config('svn.pathnameencoding');
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,11 +144,12 @@ sub repo_path {
|
|||||||
|
|
||||||
sub url_path {
|
sub url_path {
|
||||||
my ($self, $path) = @_;
|
my ($self, $path) = @_;
|
||||||
|
$path = $self->repo_path($path);
|
||||||
if ($self->{url} =~ m#^https?://#) {
|
if ($self->{url} =~ m#^https?://#) {
|
||||||
# characters are taken from subversion/libsvn_subr/path.c
|
# characters are taken from subversion/libsvn_subr/path.c
|
||||||
$path =~ s#([^~a-zA-Z0-9_./!$&'()*+,-])#sprintf("%%%02X",ord($1))#eg;
|
$path =~ s#([^~a-zA-Z0-9_./!$&'()*+,-])#sprintf("%%%02X",ord($1))#eg;
|
||||||
}
|
}
|
||||||
$self->{url} . '/' . $self->repo_path($path);
|
$self->{url} . '/' . $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rmdirs {
|
sub rmdirs {
|
||||||
|
@ -186,3 +186,15 @@ start_svnserve () {
|
|||||||
--listen-host 127.0.0.1 &
|
--listen-host 127.0.0.1 &
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepare_a_utf8_locale () {
|
||||||
|
a_utf8_locale=$(locale -a | sed -n '/\.[uU][tT][fF]-*8$/{
|
||||||
|
p
|
||||||
|
q
|
||||||
|
}')
|
||||||
|
if test -n "$a_utf8_locale"
|
||||||
|
then
|
||||||
|
test_set_prereq UTF8
|
||||||
|
else
|
||||||
|
say "# UTF-8 locale not available, some tests are skipped"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
@ -77,11 +77,47 @@ test_expect_success 'make a commit to test rebase' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'git svn rebase works inside a fresh-cloned repository' '
|
test_expect_success 'git svn rebase works inside a fresh-cloned repository' '
|
||||||
cd test-rebase &&
|
(
|
||||||
|
cd test-rebase &&
|
||||||
git svn rebase &&
|
git svn rebase &&
|
||||||
test -e test-rebase-main &&
|
test -e test-rebase-main &&
|
||||||
test -e test-rebase
|
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
|
||||||
|
'
|
||||||
|
|
||||||
|
# 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
|
stop_httpd
|
||||||
|
|
||||||
|
@ -14,17 +14,7 @@ compare_git_head_with () {
|
|||||||
test_cmp current "$1"
|
test_cmp current "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
a_utf8_locale=$(locale -a | sed -n '/\.[uU][tT][fF]-*8$/{
|
prepare_a_utf8_locale
|
||||||
p
|
|
||||||
q
|
|
||||||
}')
|
|
||||||
|
|
||||||
if test -n "$a_utf8_locale"
|
|
||||||
then
|
|
||||||
test_set_prereq UTF8
|
|
||||||
else
|
|
||||||
say "# UTF-8 locale not available, some tests are skipped"
|
|
||||||
fi
|
|
||||||
|
|
||||||
compare_svn_head_with () {
|
compare_svn_head_with () {
|
||||||
# extract just the log message and strip out committer info.
|
# extract just the log message and strip out committer info.
|
||||||
|
Loading…
Reference in New Issue
Block a user