Merge branch 'jc/lock-report-on-error'
[gitweb.git] / perl / Git / SVN / Fetcher.pm
index 613055a3f5f794d02644e32dbaf91f907836b396..64e900a0e910eea63943dfd129e595697b81c542 100644 (file)
@@ -7,10 +7,10 @@ package Git::SVN::Fetcher;
 use SVN::Delta;
 use Carp qw/croak/;
 use File::Basename qw/dirname/;
-use IO::File qw//;
 use Git qw/command command_oneline command_noisy command_output_pipe
            command_input_pipe command_close_pipe
-           command_bidi_pipe command_close_bidi_pipe/;
+           command_bidi_pipe command_close_bidi_pipe
+           get_record/;
 BEGIN {
        @ISA = qw(SVN::Delta::Editor);
 }
@@ -87,11 +87,9 @@ sub _mark_empty_symlinks {
        my $printed_warning;
        chomp(my $empty_blob = `git hash-object -t blob --stdin < /dev/null`);
        my ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt);
-       local $/ = "\0";
        my $pfx = defined($switch_path) ? $switch_path : $git_svn->path;
        $pfx .= '/' if length($pfx);
-       while (<$ls>) {
-               chomp;
+       while (defined($_ = get_record($ls, "\0"))) {
                s/\A100644 blob $empty_blob\t//o or next;
                unless ($printed_warning) {
                        print STDERR "Scanning for empty symlinks, ",
@@ -180,9 +178,7 @@ sub delete_entry {
                my ($ls, $ctx) = command_output_pipe(qw/ls-tree
                                                     -r --name-only -z/,
                                                     $tree);
-               local $/ = "\0";
-               while (<$ls>) {
-                       chomp;
+               while (defined($_ = get_record($ls, "\0"))) {
                        my $rmpath = "$gpath/$_";
                        $self->{gii}->remove($rmpath);
                        print "\tD\t$rmpath\n" unless $::_q;
@@ -248,9 +244,7 @@ sub add_directory {
                my ($ls, $ctx) = command_output_pipe(qw/ls-tree
                                                     -r --name-only -z/,
                                                     $self->{c});
-               local $/ = "\0";
-               while (<$ls>) {
-                       chomp;
+               while (defined($_ = get_record($ls, "\0"))) {
                        $self->{gii}->remove($_);
                        print "\tD\t$_\n" unless $::_q;
                        push @deleted_gpath, $gpath;
@@ -608,7 +602,7 @@ =head1 DESCRIPTION
 =head1 DEPENDENCIES
 
 L<SVN::Delta> from the Subversion perl bindings,
-the core L<Carp>, L<File::Basename>, and L<IO::File> modules,
+the core L<Carp> and L<File::Basename> modules,
 and git's L<Git> helper module.
 
 C<Git::SVN::Fetcher> has not been tested using callers other than