Merge branch 'jk/no-looking-at-dotgit-outside-repo'
[gitweb.git] / perl / Git / SVN / Editor.pm
index 4c4199afecac2c5fc6d918cf0d3b75449504b808..0df16ed72688f77058f471fddfdd25809d8926ae 100644 (file)
@@ -7,7 +7,9 @@ package Git::SVN::Editor;
 use Carp qw/croak/;
 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);
 }
@@ -57,11 +59,9 @@ sub generate_diff {
        push @diff_tree, "-l$_rename_limit" if defined $_rename_limit;
        push @diff_tree, $tree_a, $tree_b;
        my ($diff_fh, $ctx) = command_output_pipe(@diff_tree);
-       local $/ = "\0";
        my $state = 'meta';
        my @mods;
-       while (<$diff_fh>) {
-               chomp $_; # this gets rid of the trailing "\0"
+       while (defined($_ = get_record($diff_fh, "\0"))) {
                if ($state eq 'meta' && /^:(\d{6})\s(\d{6})\s
                                        ($::sha1)\s($::sha1)\s
                                        ([MTCRAD])\d*$/xo) {
@@ -173,9 +173,7 @@ sub rmdirs {
 
        my ($fh, $ctx) = command_output_pipe(qw/ls-tree --name-only -r -z/,
                                             $self->{tree_b});
-       local $/ = "\0";
-       while (<$fh>) {
-               chomp;
+       while (defined($_ = get_record($fh, "\0"))) {
                my @dn = split m#/#, $_;
                while (pop @dn) {
                        delete $rm->{join '/', @dn};