修改後的 cvsimport (我用的是cygwin版的git 1.7.5.1, cvsimport是存在C:\cygwin\lib\git-core)
1. 在檔案的開頭部份增加lib 'Encode'
use IPC::Open2;
require Encode; ## add this line
#system(qw(git init); ##origin
system(qw(git init --bare --share)); ## replace by robin 20120208
3. logmsg轉碼,搜尋 "sub commit {" 並加入下面的 code
4. 執行cvsimport
Tada...
sub commit {
## +20120208 by robin for commit message utf-8
my $msg = $logmsg;
eval { $msg = Encode::decode('BIG5', $msg, 1) }; ## origin charset BIG-5, GBK
if ($@) {
die "Could not decode as 'big5':\n", $msg,
"\nPerhaps you need to set i18n.commitencoding\n";
}
eval { $msg = Encode::encode('UTF-8', $msg, 1) };
die "Could not encode as UTF-8:\n$msg\n" if $@;
$logmsg = $msg;
## patch2
my $fragment = substr $logmsg, 0, index($logmsg, 'Committed on the');
$logmsg = $fragment;
#print $logmsg;
#print $msg;
4. 執行cvsimport
$ mkdir aprj.git $ cd aprj.git $ git init --bare --share $ export CVSROOT=:pserver:robin@10.1.251.16:/aprj $ cvs login $ git cvsimport -p -x -v -d :pserver:robin@10.1.251.16:/aprj amodule