From: Robert Pollak <robert.pollak@gmail.com>
To: Eric Wong <normalperson@yhbt.net>
Cc: Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua>, git@vger.kernel.org
Subject: Re: [PATCH] git svn: add an option to recode pathnames
Date: Fri, 30 Jul 2010 04:30:13 +0200 [thread overview]
Message-ID: <4C523935.5070504@gmail.com> (raw)
In-Reply-To: <20090729185919.GA13518@dcvr.yhbt.net>
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.
Signed-off-by: Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua>
[robert.pollak@gmail.com: renamed the option and added manpage documentation]
Signed-off-by: Robert Pollak <robert.pollak@gmail.com>
---
Hello Eric,
since the patch is useful to me, I have made the requested option name
change and added some manpage documentation. Please consider applying the
patch or give me additional feedback.
This is the first patch I submit on this list, so I hope it's ok.
Best regards,
Robert
Documentation/git-svn.txt | 6 ++++++
git-svn.perl | 9 +++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index b09bd97..4b84d08 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -646,6 +646,12 @@ svn.brokenSymlinkWorkaround::
revision fetched. If unset, 'git svn' assumes this option to
be "true".
+svn.pathnameencoding::
+ This 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.
+ Valid encodings are the ones supported by Perl's Encode module.
+
Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and useSvmProps
options all affect the metadata generated and used by 'git svn'; they
*must* be set in the configuration file before any history is imported
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 : '');
}
--
1.6.3.3
next prev parent reply other threads:[~2010-07-30 2:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2010-07-30 7:59 ` Eric Wong
2010-08-02 10:36 ` Dmitry Statyvka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C523935.5070504@gmail.com \
--to=robert.pollak@gmail.com \
--cc=dstatyvka@tmsoft-ltd.kiev.ua \
--cc=git@vger.kernel.org \
--cc=normalperson@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).