summaryrefslogtreecommitdiff
path: root/git-cvsimport.perl
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2006-02-18 21:44:20 +0100
committerJunio C Hamano <junkio@cox.net>2006-02-18 16:19:00 -0800
commit39ba7d54649b35c943b026b54bff40cfa0153f3e (patch)
tree20dd2334f20df423ea9ea08c9b106811619e09ef /git-cvsimport.perl
parent3ff903bfb9e34a02f681f1c95ef7aa3ce4d54d2a (diff)
downloadgit-39ba7d54649b35c943b026b54bff40cfa0153f3e.tar.gz
Fix retries in git-cvsimportv1.2.2
Fixed a couple of bugs in recovering from broken connections: The _line() method now returns undef correctly when the connection is broken instead of falling off the function and returning garbage. Retries are now reported to stderr and the eventual partially downloaded file is discarded instead of being appended to. The "Server gone away" test has been removed, because it was reachable only if the garbage return bug bit. Signed-off-by: Martin Mares <mj@ucw.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-cvsimport.perl')
-rwxr-xr-xgit-cvsimport.perl13
1 files changed, 5 insertions, 8 deletions
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 00fc3bacda..24f9834342 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -361,6 +361,7 @@ sub _line {
}
}
}
+ return undef;
}
sub file {
my($self,$fn,$rev) = @_;
@@ -372,19 +373,15 @@ sub file {
$self->_file($fn,$rev) and $res = $self->_line($fh);
if (!defined $res) {
- # retry
+ print STDERR "Server has gone away while fetching $fn $rev, retrying...\n";
+ truncate $fh, 0;
$self->conn();
- $self->_file($fn,$rev)
- or die "No file command send\n";
+ $self->_file($fn,$rev) or die "No file command send";
$res = $self->_line($fh);
- die "No input: $fn $rev\n" unless defined $res;
+ die "Retry failed" unless defined $res;
}
close ($fh);
- if ($res eq '') {
- die "Looks like the server has gone away while fetching $fn $rev -- exiting!";
- }
-
return ($name, $res);
}