Skip to content

Commit e25eb4c

Browse files
committed
Win32 support
binmode the pipe, use tabs not nulls, and on windows use double quotes not single quotes
1 parent b1aef3c commit e25eb4c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Porting/updateAUTHORS.pm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ my %field_spec= (
4848
my $Collate= Unicode::Collate->new(level => 1, indentical => 1);
4949
my @field_codes= sort keys %field_spec;
5050
my @field_names= map { $field_spec{$_} } @field_codes;
51-
my $tformat= "=" . join "%x00", map { "%" . $_ } @field_codes;
51+
my $tformat= "=" . join "%x09", map { "%" . $_ } @field_codes;
5252

5353
sub _make_name_author_info {
5454
my ($self, $commit_info, $name_key)= @_;
@@ -158,7 +158,10 @@ sub read_commit_log {
158158

159159
my $last_commit_info;
160160
my $cmd= qq(git log --pretty='format:$tformat' $numstat $commit_range);
161-
open my $fh, "$cmd |";
161+
$cmd=~s/'/"/g if $^O=~/Win/;
162+
open my $fh, "-|", $cmd
163+
or die "Failed to open pipe: $!";
164+
binmode($fh);
162165
while (defined(my $line= <$fh>)) {
163166
chomp $line;
164167
$line= decode_utf8($line);
@@ -187,7 +190,7 @@ sub read_commit_log {
187190
$commits_read++;
188191
my $commit_info= {};
189192
$last_commit_info= $commit_info;
190-
@{$commit_info}{@field_names}= split /\0/, $line, 0 + @field_names;
193+
@{$commit_info}{@field_names}= split /\t/, $line, 0 + @field_names;
191194

192195
my $author_name_mm_canon=
193196
$self->_make_name_author_info($commit_info, "author_name_mm");

0 commit comments

Comments
 (0)