X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=contrib%2Fgit-svn%2Fgit-svn.perl;h=8d2e7f74ea15d27d8380a756f41b0f22b7d88013;hb=4a393f2b53f0997f79d47793d4c774fa0072887c;hp=7ed11ef0a559f1d8877a798983fb1f19a2981f76;hpb=8a97e368882afbc2bdc030214339bed54ed6545c;p=git.git diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl index 7ed11ef0..8d2e7f74 100755 --- a/contrib/git-svn/git-svn.perl +++ b/contrib/git-svn/git-svn.perl @@ -866,19 +866,26 @@ sub eol_cp { binmode $wfd or croak $!; my $eol = $EOL{$es} or undef; - if ($eol) { - print "$eol: $from => $to\n"; - } my $buf; + use bytes; while (1) { my ($r, $w, $t); defined($r = sysread($rfd, $buf, 4096)) or croak $!; return unless $r; - $buf =~ s/(?:\015|\012|\015\012)/$eol/gs if $eol; + if ($eol) { + if ($buf =~ /\015$/) { + my $c; + defined($r = sysread($rfd,$c,1)) or croak $!; + $buf .= $c if $r > 0; + } + $buf =~ s/(?:\015\012|\015|\012)/$eol/gs; + $r = length($buf); + } for ($w = 0; $w < $r; $w += $t) { $t = syswrite($wfd, $buf, $r - $w, $w) or croak $!; } } + no bytes; } sub do_update_index {