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

[PATCH] cvsimport: introduce -L<imit> option to workaround memory leaks

From
MLMartin Langhoff <martin@catalyst.net.nz>
Date
May 22, 2006, 11:38 UTC
Message-ID
<11482978883713-git-send-email-martin@catalyst.net.nz>
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>

--- This is ugly, but while I work on cleaning up the leak that seems to be somewhere in the commit() sub, we may as well set up a workaround.

I am not 100% happy woth including this in git.git. In any case, I hope we can revert it soon.

---
 git-cvsimport.perl |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
64ea3c83d8cd176ee972055bd1d11f398655dad8
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index c0ae00b..c1923d1 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -29,7 +29,7 @@ use IPC::Open2;
 $SIG{'PIPE'}="IGNORE";
 $ENV{'TZ'}="UTC";
 
-our($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,$opt_M,$opt_A,$opt_S);
+our($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,$opt_M,$opt_A,$opt_S,$opt_L);
 my (%conv_author_name, %conv_author_email);
 
 sub usage() {
@@ -85,7 +85,7 @@ sub write_author_info($) {
 	close ($f);
 }
 
-getopts("hivmkuo:d:p:C:z:s:M:P:A:S:") or usage();
+getopts("hivmkuo:d:p:C:z:s:M:P:A:S:L:") or usage();
 usage if $opt_h;
 
 @ARGV <= 1 or usage();
@@ -716,6 +716,7 @@ my $commit = sub {
 	}
 };
 
+my $commitcount = 1;
 while(<CVS>) {
 	chomp;
 	if($state == 0 and /^-+$/) {
@@ -849,6 +850,9 @@ #	VERSION:1.96->1.96.2.1
 	} elsif($state == 9 and /^\s*$/) {
 		$state = 10;
 	} elsif(($state == 9 or $state == 10) and /^-+$/) {
+		if ($opt_L && $commitcount++ >= $opt_L) {
+			last;
+		}
 		&$commit();
 		$state = 1;
 	} elsif($state == 11 and /^-+$/) {
-- 
1.3.2.g82000
Next: Linus Torvalds
Message 1 of 10 in “cvsimport: introduce -L<imit> option to workaround memory leaks”
  1. cvsimport: introduce -L<imit> option to workaround memory leaksMartin Langhoff, May 22, 2006
  2. Linus TorvaldsMay 23, 2006
  3. Martin Langhoff (CatalystIT)May 23, 2006
  4. Theodore TsoMay 23, 2006
  5. Linus TorvaldsMay 23, 2006
  6. Linus TorvaldsMay 23, 2006
  7. Martin LanghoffMay 26, 2006
  8. Linus TorvaldsMay 26, 2006
  9. Jakub NarebskiMay 26, 2006
  10. Martin LanghoffMay 26, 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.