aboutsummaryrefslogtreecommitdiff
path: root/git-cvsimport.perl
diff options
context:
space:
mode:
authorMartin Langhoff <martin@catalyst.net.nz>2006-05-22 23:38:08 +1200
committerJunio C Hamano <junkio@cox.net>2006-05-23 00:29:35 -0700
commit06918348de86774d0fad19c7076747b8182d1c74 (patch)
tree09bf6352476fd06c5d650c16e22e0d18c5a0071e /git-cvsimport.perl
parent7f7e6eacf999cb53771426e561589f721e6c9974 (diff)
downloadgit-06918348de86774d0fad19c7076747b8182d1c74.tar.gz
git-06918348de86774d0fad19c7076747b8182d1c74.tar.xz
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>
Diffstat (limited to 'git-cvsimport.perl')
-rwxr-xr-xgit-cvsimport.perl8
1 files changed, 6 insertions, 2 deletions
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index d257e668d..6c232c0d4 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();
@@ -719,6 +719,7 @@ sub commit {
}
};
+my $commitcount = 1;
while(<CVS>) {
chomp;
if($state == 0 and /^-+$/) {
@@ -852,6 +853,9 @@ while(<CVS>) {
} 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 /^-+$/) {