git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cvsimport: introduce -L<imit> option to workaround memory leaks
@ 2006-05-22 11:38 Martin Langhoff
  2006-05-23  2:28 ` Linus Torvalds
  0 siblings, 1 reply; 10+ messages in thread
From: Martin Langhoff @ 2006-05-22 11:38 UTC (permalink / raw)
  To: git, junkio, Johannes.Schindelin, torvals, spyderous, smurf
  Cc: Martin Langhoff

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-05-26  6:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-22 11:38 [PATCH] cvsimport: introduce -L<imit> option to workaround memory leaks Martin Langhoff
2006-05-23  2:28 ` Linus Torvalds
2006-05-23  3:15   ` Martin Langhoff (CatalystIT)
2006-05-23 15:36   ` Theodore Tso
2006-05-23 16:05     ` Linus Torvalds
2006-05-23 16:25       ` Linus Torvalds
2006-05-26  0:42   ` Martin Langhoff
2006-05-26  5:20     ` Linus Torvalds
2006-05-26  5:29       ` Jakub Narebski
2006-05-26  6:02       ` Martin Langhoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).