Skip to content

Instantly share code, notes, and snippets.

@miau
Created October 15, 2011 18:50
Show Gist options
  • Select an option

  • Save miau/1289974 to your computer and use it in GitHub Desktop.

Select an option

Save miau/1289974 to your computer and use it in GitHub Desktop.
patch for git-svn in UTF-8 version of msysGit to use multibyte filenames

UTF-8ファイル名対応版 Git for Windows を使っている人向けの、git-svn で UTF-8 ファイル名を扱えるようにするためのパッチです。 svn.pathnameencoding は設定せずに使ってください。

diff --git a/lib/perl5/site_perl/Git.pm b/lib/perl5/site_perl/Git.pm
index 6d38dd1..e21fae0 100644
--- a/lib/perl5/site_perl/Git.pm
+++ b/lib/perl5/site_perl/Git.pm
@@ -1277,9 +1277,20 @@ sub _command_common_pipe {
open (STDERR, '>&', $opts{STDERR})
or die "dup failed: $!";
}
+ require Encode;
+ foreach my $arg (@args) {
+ Encode::from_to($arg, 'utf-8', 'cp932');
+ }
_cmd_exec($self, $cmd, @args);
}
}
+ if ($direction eq '-|' and not (
+ $cmd eq 'cat-file'
+ or $cmd eq 'log'
+ or $cmd eq 'rev-list' and grep { $_ eq '--pretty=raw' } @args)) {
+ require Encode;
+ binmode $fh, ':encoding(cp932):bytes';
+ }
return wantarray ? ($fh, join(' ', $cmd, @args)) : $fh;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment