cvsimport: catch error condition where cvs host disappears
[git.git] / git-cvsimport.perl
index 0621dc3..e3cad5a 100755 (executable)
@@ -337,6 +337,10 @@ sub file {
        }
        close ($fh);
 
+       if ($res eq '') {
+           die "Looks like the server has gone away while fetching $fn $rev -- exiting!";
+       }
+
        return ($name, $res);
 }
 
@@ -487,7 +491,7 @@ unless($pid) {
        my @opt;
        @opt = split(/,/,$opt_p) if defined $opt_p;
        unshift @opt, '-z', $opt_z if defined $opt_z;
-       unless ($opt_p =~ m/--no-cvs-direct/) {
+       unless (defined($opt_p) && $opt_p =~ m/--no-cvs-direct/) {
                push @opt, '--cvs-direct';
        }
        exec("cvsps",@opt,"-u","-A",'--root',$opt_d,$cvs_tree);