aboutsummaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorMichael Weber <michaelw@foldr.org>2008-04-18 15:12:04 +0200
committerJunio C Hamano <gitster@pobox.com>2008-04-22 21:43:58 -0700
commit4f7ec7970874d09be162bc7f16415a0ec2d36ae5 (patch)
treeaaeceb6cee12421e531b63244b67caff01533f23 /git-svn.perl
parenta6f47b2be43fbe70236316edc6c87ad9522c485d (diff)
downloadgit-4f7ec7970874d09be162bc7f16415a0ec2d36ae5.tar.gz
git-4f7ec7970874d09be162bc7f16415a0ec2d36ae5.tar.xz
svn-git: Use binmode for reading/writing binary rev maps
Otherwise, there is a possible interaction with UTF-8 locales in combination with PERL_UNICODE, resulting in "inconsistent size: 40" or "read:"-type errors. See also: perldoc -f binmode <http://perldoc.perl.org/perl581delta.html#UTF-8-no-longer-default-under-UTF-8-locales> Signed-off-by: Michael Weber <michaelw@foldr.org> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl4
1 files changed, 4 insertions, 0 deletions
diff --git a/git-svn.perl b/git-svn.perl
index fcfe4eeaa..49dd80644 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2506,6 +2506,7 @@ sub rebuild_from_rev_db {
my ($self, $path) = @_;
my $r = -1;
open my $fh, '<', $path or croak "open: $!";
+ binmode $fh or croak "binmode: $!";
while (<$fh>) {
length($_) == 41 or croak "inconsistent size in ($_) != 41";
chomp($_);
@@ -2603,6 +2604,7 @@ sub rebuild {
sub _rev_map_set {
my ($fh, $rev, $commit) = @_;
+ binmode $fh or croak "binmode: $!";
my $size = (stat($fh))[7];
($size % 24) == 0 or croak "inconsistent size: $size";
@@ -2706,6 +2708,7 @@ sub rev_map_max {
my $map_path = $self->map_path;
stat $map_path or return $want_commit ? (0, undef) : 0;
sysopen(my $fh, $map_path, O_RDONLY) or croak "open: $!";
+ binmode $fh or croak "binmode: $!";
my $size = (stat($fh))[7];
($size % 24) == 0 or croak "inconsistent size: $size";
@@ -2738,6 +2741,7 @@ sub rev_map_get {
return undef unless -e $map_path;
sysopen(my $fh, $map_path, O_RDONLY) or croak "open: $!";
+ binmode $fh or croak "binmode: $!";
my $size = (stat($fh))[7];
($size % 24) == 0 or croak "inconsistent size: $size";