@matheusbsbs / matheus-bagliano / commits / 06918348de
Fork 0

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

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>

Martin Langhoff committed May 22, 2006 at 23:38 UTC 06918348de86774d0fad19c7076747b8182d1c74
1 file changed +6 -2
git-cvsimport.perl
+6 -2
@@ -29,7 +29,7 @@ use IPC::Open2;
29 $SIG{'PIPE'}="IGNORE";
30 $ENV{'TZ'}="UTC";
31
32 -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);
32 +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);
33 my (%conv_author_name, %conv_author_email);
34
35 sub usage() {
@@ -85,7 +85,7 @@ sub write_author_info($) {
85 close ($f);
86 }
87
88 -getopts("hivmkuo:d:p:C:z:s:M:P:A:S:") or usage();
88 +getopts("hivmkuo:d:p:C:z:s:M:P:A:S:L:") or usage();
89 usage if $opt_h;
90
91 @ARGV <= 1 or usage();
@@ -719,6 +719,7 @@ sub commit {
719 }
720 };
721
722 +my $commitcount = 1;
723 while(<CVS>) {
724 chomp;
725 if($state == 0 and /^-+$/) {
@@ -852,6 +853,9 @@ while(<CVS>) {
853 } elsif($state == 9 and /^\s*$/) {
854 $state = 10;
855 } elsif(($state == 9 or $state == 10) and /^-+$/) {
856 + if ($opt_L && $commitcount++ >= $opt_L) {
857 + last;
858 + }
859 commit();
860 $state = 1;
861 } elsif($state == 11 and /^-+$/) {