summaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorDmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua>2010-07-30 02:30:13 (GMT)
committerEric Wong <normalperson@yhbt.net>2010-07-30 07:49:21 (GMT)
commit3713e2226bcda64513efd537f370ce4d7f767a1e (patch)
tree7bbdb6d27c5bbea17cfbe6ab0d585b06da543f5b /git-svn.perl
parent61bf126ecb24977b883079942b71ff96174c19fb (diff)
downloadgit-3713e2226bcda64513efd537f370ce4d7f767a1e.zip
git-3713e2226bcda64513efd537f370ce4d7f767a1e.tar.gz
git-3713e2226bcda64513efd537f370ce4d7f767a1e.tar.bz2
git svn: add an option to recode pathnames
Introduce a new option 'svn.pathnameencoding' that instructs git svn to recode pathnames to a given encoding. It can be used by windows users and by those who work in non-utf8 locales to avoid corrupted file names with non-ascii characters. [rp: renamed the option and added manpage documentation] Signed-off-by: Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua> Signed-off-by: Robert Pollak <robert.pollak@gmail.com> Acked-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl9
1 files changed, 9 insertions, 0 deletions
diff --git a/git-svn.perl b/git-svn.perl
index c416358..c92238e 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -4050,6 +4050,7 @@ sub new {
$self->{absent_dir} = {};
$self->{absent_file} = {};
$self->{gii} = $git_svn->tmp_index_do(sub { Git::IndexInfo->new });
+ $self->{pathnameencoding} = Git::config('svn.pathnameencoding');
$self;
}
@@ -4133,6 +4134,10 @@ sub open_directory {
sub git_path {
my ($self, $path) = @_;
+ if (my $enc = $self->{pathnameencoding}) {
+ require Encode;
+ Encode::from_to($path, 'UTF-8', $enc);
+ }
if ($self->{path_strip}) {
$path =~ s!$self->{path_strip}!! or
die "Failed to strip path '$path' ($self->{path_strip})\n";
@@ -4521,6 +4526,10 @@ sub split_path {
sub repo_path {
my ($self, $path) = @_;
+ if (my $enc = $self->{pathnameencoding}) {
+ require Encode;
+ Encode::from_to($path, $enc, 'UTF-8');
+ }
$self->{path_prefix}.(defined $path ? $path : '');
}