git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git svn: add an option to recode pathnames
@ 2009-07-29  9:16 Dmitry Statyvka
  2009-07-29 18:59 ` Eric Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Statyvka @ 2009-07-29  9:16 UTC (permalink / raw)


Introduce new option 'svn.pathnameenc' that instructs git svn to recode
pathnames to given encoding.  It's useful for windows users and for those
who works in non-utf8 locales, since otherwise they'll have corrupted file
names with non-ascii characters.

Signed-off-by: Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua>
---
 git-svn.perl |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index ef1d30d..bdd9af0 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3343,6 +3343,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.pathnameenc');
 	$self;
 }
 
@@ -3426,6 +3427,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";
@@ -3814,6 +3819,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 : '');
 }
 
-- 
1.6.3.2.1299.gee46c

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-02 11:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-29  9:16 [PATCH] git svn: add an option to recode pathnames Dmitry Statyvka
2009-07-29 18:59 ` Eric Wong
2010-07-30  2:30   ` Robert Pollak
2010-07-30  7:59     ` Eric Wong
2010-08-02 10:36       ` Dmitry Statyvka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).