From 9231f500c394ede405fcfdca151dd7758ce99ced Mon Sep 17 00:00:00 2001 From: Thomas Guyot-Sionnest Date: Tue, 22 Apr 2008 06:07:47 -0400 Subject: git-svn bug with blank commits and author file When trying to import from svn using an author file, git-svn bails out if it encounters a blank author. The attached patch changes this behavior and allow using the author file with blanks authors. I came across this bug while importing from a cvs2svn repo where the initial revision (1) has a blank author. This doesn't break the behavior of bailing out when an unknown author is encountered. Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- git-svn.perl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'git-svn.perl') diff --git a/git-svn.perl b/git-svn.perl index e0434099c..fcfe4eeaa 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2363,8 +2363,7 @@ sub check_author { my ($author) = @_; if (!defined $author || length $author == 0) { $author = '(no author)'; - } - if (defined $::_authors && ! defined $::users{$author}) { + } elsif (defined $::_authors && ! defined $::users{$author}) { die "Author: $author not defined in $::_authors file\n"; } $author; -- cgit v1.2.1 From 4f7ec7970874d09be162bc7f16415a0ec2d36ae5 Mon Sep 17 00:00:00 2001 From: Michael Weber Date: Fri, 18 Apr 2008 15:12:04 +0200 Subject: 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 Signed-off-by: Michael Weber Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- git-svn.perl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'git-svn.perl') 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"; -- cgit v1.2.1