Skip to content

Commit

Permalink
cvsimport: introduce -L<imit> option to workaround memory leaks
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Martin Langhoff authored and Junio C Hamano committed May 23, 2006
1 parent 7f7e6ea commit 0691834
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions git-cvsimport.perl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
$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() {
Expand Down Expand Up @@ -85,7 +85,7 @@ ($)
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();
Expand Down Expand Up @@ -719,6 +719,7 @@ sub commit {
}
};

my $commitcount = 1;
while(<CVS>) {
chomp;
if($state == 0 and /^-+$/) {
Expand Down Expand Up @@ -852,6 +853,9 @@ sub commit {
} 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 /^-+$/) {
Expand Down

0 comments on commit 0691834

Please sign in to comment.