git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix retries in git-cvsimport

From
MMMartin Mares <mj@ucw.cz>
Date
Feb 18, 2006, 20:44 UTC
Message-ID
<mj+md-20060218.203658.16817.albireo@ucw.cz>
In-Reply-To
<7vvevco6e3.fsf@assigned-by-dhcp.cox.net>
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>

--- old/git-cvsimport 2006-02-17 13:02:24.000000000 +0100 +++ new/git-cvsimport 2006-02-18 14:16:33.000000000 +0100

@@ -361,6 +361,7 @@
 			}
 		}
 	}
+	return undef;
 }
 sub file {
 	my($self,$fn,$rev) = @_;
@@ -372,19 +373,15 @@
 	$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);
 }
 
Previous: Junio C Hamano
Message 5 of 5 in “git-cvs-import retries”
  1. Martin MaresFeb 17, 2006
  2. Junio C HamanoFeb 18, 2006
  3. Martin MaresFeb 18, 2006
  4. Junio C HamanoFeb 18, 2006
  5. Fix retries in git-cvsimportMartin Mares, Feb 18, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.