{"thread":{"id":"20276","subject":"[PATCH] git svn: add an option to recode pathnames","startedAt":"2009-07-29T09:16:53Z","lastAt":"2010-08-02T10:36:02Z","messageCount":5,"participants":["Dmitry Statyvka","Eric Wong","Robert Pollak"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"119049","messageId":"ylnfxcfdeyq.fsf@tmsoft-ltd.kiev.ua","threadId":"20276","inReplyTo":null,"subject":"[PATCH] git svn: add an option to recode pathnames","fromName":"Dmitry Statyvka","fromEmail":"dstatyvka@tmsoft-ltd.kiev.ua","sentAt":"2009-07-29T09:16:53Z","receivedAt":"2009-07-29T09:16:53Z","isPatch":true,"sender":{"key":"dstatyvka@tmsoft-ltd.kiev.ua","avatar":null},"body":"Introduce new option 'svn.pathnameenc' that instructs git svn to recode\npathnames to given encoding.  It's useful for windows users and for those\nwho works in non-utf8 locales, since otherwise they'll have corrupted file\nnames with non-ascii characters.\n\nSigned-off-by: Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua>\n---\n git-svn.perl |    9 +++++++++\n 1 files changed, 9 insertions(+), 0 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex ef1d30d..bdd9af0 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3343,6 +3343,7 @@ sub new {\n \t$self->{absent_dir} = {};\n \t$self->{absent_file} = {};\n \t$self->{gii} = $git_svn->tmp_index_do(sub { Git::IndexInfo->new });\n+\t$self->{pathnameencoding} = Git::config('svn.pathnameenc');\n \t$self;\n }\n \n@@ -3426,6 +3427,10 @@ sub open_directory {\n \n sub git_path {\n \tmy ($self, $path) = @_;\n+\tif (my $enc = $self->{pathnameencoding}) {\n+\t\trequire Encode;\n+\t\tEncode::from_to($path, 'UTF-8', $enc);\n+\t}\n \tif ($self->{path_strip}) {\n \t\t$path =~ s!$self->{path_strip}!! or\n \t\t  die \"Failed to strip path '$path' ($self->{path_strip})\\n\";\n@@ -3814,6 +3819,10 @@ sub split_path {\n \n sub repo_path {\n \tmy ($self, $path) = @_;\n+\tif (my $enc = $self->{pathnameencoding}) {\n+\t\trequire Encode;\n+\t\tEncode::from_to($path, $enc, 'UTF-8');\n+\t}\n \t$self->{path_prefix}.(defined $path ? $path : '');\n }\n \n-- \n1.6.3.2.1299.gee46c\n"},{"id":"119091","messageId":"20090729185919.GA13518@dcvr.yhbt.net","threadId":"20276","inReplyTo":"ylnfxcfdeyq.fsf@tmsoft-ltd.kiev.ua","subject":"Re: [PATCH] git svn: add an option to recode pathnames","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-07-29T18:59:19Z","receivedAt":"2009-07-29T18:59:19Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua> wrote:\n> Introduce new option 'svn.pathnameenc' that instructs git svn to recode\n> pathnames to given encoding.  It's useful for windows users and for those\n> who works in non-utf8 locales, since otherwise they'll have corrupted file\n> names with non-ascii characters.\n> \n> Signed-off-by: Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua>\n> ---\n>  git-svn.perl |    9 +++++++++\n>  1 files changed, 9 insertions(+), 0 deletions(-)\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index ef1d30d..bdd9af0 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -3343,6 +3343,7 @@ sub new {\n>  \t$self->{absent_dir} = {};\n>  \t$self->{absent_file} = {};\n>  \t$self->{gii} = $git_svn->tmp_index_do(sub { Git::IndexInfo->new });\n> +\t$self->{pathnameencoding} = Git::config('svn.pathnameenc');\n\nHi Dmitry,\n\nCan we use a more consistent name for the user-visible config option?\n\"svn.pathnameencoding\" would be more consistent with the other\nencoding-related config options we have.\n\nI'd also like this option documented in the manpage so more people know\nabout it.\n\nOtherwise the patch looks fine though a testcase would be helpful, too.\n\nThanks!\n\n-- \nEric Wong\n"},{"id":"146751","messageId":"4C523935.5070504@gmail.com","threadId":"20276","inReplyTo":"20090729185919.GA13518@dcvr.yhbt.net","subject":"Re: [PATCH] git svn: add an option to recode pathnames","fromName":"Robert Pollak","fromEmail":"robert.pollak@gmail.com","sentAt":"2010-07-30T02:30:13Z","receivedAt":"2010-07-30T02:30:13Z","isPatch":true,"sender":{"key":"robert.pollak@gmail.com","avatar":null},"body":"Introduce a new option 'svn.pathnameencoding' that instructs git svn to\nrecode pathnames to a given encoding.  It can be used by windows users\nand by those who work in non-utf8 locales to avoid corrupted file names\nwith non-ascii characters.\n\nSigned-off-by: Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua>\n[robert.pollak@gmail.com: renamed the option and added manpage documentation]\nSigned-off-by: Robert Pollak <robert.pollak@gmail.com>\n---\n\nHello Eric,\n\nsince the patch is useful to me, I have made the requested option name\nchange and added some manpage documentation. Please consider applying the\npatch or give me additional feedback.\n\nThis is the first patch I submit on this list, so I hope it's ok.\n\nBest regards,\nRobert\n\n\n Documentation/git-svn.txt |    6 ++++++\n git-svn.perl              |    9 +++++++++\n 2 files changed, 15 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex b09bd97..4b84d08 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -646,6 +646,12 @@ svn.brokenSymlinkWorkaround::\n \trevision fetched.  If unset, 'git svn' assumes this option to\n \tbe \"true\".\n\n+svn.pathnameencoding::\n+\tThis instructs git svn to recode pathnames to a given encoding.\n+\tIt can be used by windows users and by those who work in non-utf8\n+\tlocales to avoid corrupted file names with non-ASCII characters.\n+\tValid encodings are the ones supported by Perl's Encode module.\n+\n Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and useSvmProps\n options all affect the metadata generated and used by 'git svn'; they\n *must* be set in the configuration file before any history is imported\ndiff --git a/git-svn.perl b/git-svn.perl\nindex c416358..c92238e 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -4050,6 +4050,7 @@ sub new {\n \t$self->{absent_dir} = {};\n \t$self->{absent_file} = {};\n \t$self->{gii} = $git_svn->tmp_index_do(sub { Git::IndexInfo->new });\n+\t$self->{pathnameencoding} = Git::config('svn.pathnameencoding');\n \t$self;\n }\n\n@@ -4133,6 +4134,10 @@ sub open_directory {\n\n sub git_path {\n \tmy ($self, $path) = @_;\n+\tif (my $enc = $self->{pathnameencoding}) {\n+\t\trequire Encode;\n+\t\tEncode::from_to($path, 'UTF-8', $enc);\n+\t}\n \tif ($self->{path_strip}) {\n \t\t$path =~ s!$self->{path_strip}!! or\n \t\t  die \"Failed to strip path '$path' ($self->{path_strip})\\n\";\n@@ -4521,6 +4526,10 @@ sub split_path {\n\n sub repo_path {\n \tmy ($self, $path) = @_;\n+\tif (my $enc = $self->{pathnameencoding}) {\n+\t\trequire Encode;\n+\t\tEncode::from_to($path, $enc, 'UTF-8');\n+\t}\n \t$self->{path_prefix}.(defined $path ? $path : '');\n }\n\n-- \n1.6.3.3\n"},{"id":"146757","messageId":"20100730075921.GA9596@dcvr.yhbt.net","threadId":"20276","inReplyTo":"4C523935.5070504@gmail.com","subject":"Re: [PATCH] git svn: add an option to recode pathnames","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-07-30T07:59:21Z","receivedAt":"2010-07-30T07:59:21Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Robert Pollak <robert.pollak@gmail.com> wrote:\n> Introduce a new option 'svn.pathnameencoding' that instructs git svn to\n> recode pathnames to a given encoding.  It can be used by windows users\n> and by those who work in non-utf8 locales to avoid corrupted file names\n> with non-ascii characters.\n> \n> Signed-off-by: Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua>\n> [robert.pollak@gmail.com: renamed the option and added manpage documentation]\n> Signed-off-by: Robert Pollak <robert.pollak@gmail.com>\n> ---\n> \n> Hello Eric,\n> \n> since the patch is useful to me, I have made the requested option name\n> change and added some manpage documentation. Please consider applying the\n> patch or give me additional feedback.\n\nThanks Robert!\n\nIt looks alright to me and I've acked and pushed it out to\ngit://git.bogomips.org/git-svn (crediting Dmitry as the author)\n\nIf it's not too much trouble, having a test case to ensure it stays\nworking with future changes would be nice.\n\n> This is the first patch I submit on this list, so I hope it's ok.\n\nFor addendum changes, the standard we seem to have adopted is\nfirst initials above the Signed-off/Acked-by lines:\n\n>From 3713e2226bcda64513efd537f370ce4d7f767a1e Mon Sep 17 00:00:00 2001\nFrom: Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua>\nDate: Fri, 30 Jul 2010 04:30:13 +0200\nSubject: [PATCH] git svn: add an option to recode pathnames\n\nIntroduce a new option 'svn.pathnameencoding' that instructs git svn to\nrecode pathnames to a given encoding.  It can be used by windows users\nand by those who work in non-utf8 locales to avoid corrupted file names\nwith non-ascii characters.\n\n[rp: renamed the option and added manpage documentation]\n\nSigned-off-by: Dmitry Statyvka <dstatyvka@tmsoft-ltd.kiev.ua>\nSigned-off-by: Robert Pollak <robert.pollak@gmail.com>\nAcked-by: Eric Wong <normalperson@yhbt.net>\n---\n<snip>\n-- \nEric Wong\n"},{"id":"146937","messageId":"ylnaap5714d.fsf@tmsoft-ltd.kiev.ua","threadId":"20276","inReplyTo":"20100730075921.GA9596@dcvr.yhbt.net","subject":"Re: [PATCH] git svn: add an option to recode pathnames","fromName":"Dmitry Statyvka","fromEmail":"dstatyvka@tmsoft-ltd.kiev.ua","sentAt":"2010-08-02T10:36:02Z","receivedAt":"2010-08-02T10:36:02Z","isPatch":true,"sender":{"key":"dstatyvka@tmsoft-ltd.kiev.ua","avatar":null},"body":">>>>> \"EW\" == Eric Wong <normalperson@yhbt.net> writes:\nEW> Robert Pollak <robert.pollak@gmail.com> wrote:\n\n[...]\n\n>> Hello Eric,\n>> \n>> since the patch is useful to me, I have made the requested option\n>> name change and added some manpage documentation. Please consider\n>> applying the patch or give me additional feedback.\nEW> \nEW> Thanks Robert!\nEW> \nEW> It looks alright to me and I've acked and pushed it out to\nEW> git://git.bogomips.org/git-svn (crediting Dmitry as the author)\n\nGreat!  Thank you guys very much!\n\n--\nDmitry Statyvka\n"}]}