X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-cvsimport.perl;h=ac74bc51b3197d06f13f588d6916400ac3e6fcf0;hb=a6e3768f641c2703266422aa05c05f1d01e886b2;hp=a86ee3cb18ce2d182608c4ce360d4b98844d3bad;hpb=ded9f40059b185cd88569aa349784f140418f400;p=git.git diff --git a/git-cvsimport.perl b/git-cvsimport.perl index a86ee3cb1..ac74bc51b 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -32,12 +32,15 @@ $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,$opt_L, $opt_a); my (%conv_author_name, %conv_author_email); -sub usage() { +sub usage(;$) { + my $msg = shift; + print(STDERR "Error: $msg\n") if $msg; print STDERR < '.cvsps', - DIR => File::Spec->tmpdir()); + ($cvspsfh, $cvspsfile) = tempfile('gitXXXXXX', SUFFIX => '.cvsps', + DIR => File::Spec->tmpdir()); while () { print $cvspsfh $_; } close CVSPS; close $cvspsfh; - $opt_P = $cvspsfile; +} else { + $cvspsfile = $opt_P; } - -open(CVS, "<$opt_P") or die $!; +open(CVS, "<$cvspsfile") or die $!; ## cvsps output: #--------------------- @@ -658,7 +691,7 @@ $ignorebranch{'#CVSPS_NO_BRANCH'} = 1; sub commit { if ($branch eq $opt_o && !$index{branch} && !get_headref($branch, $git_dir)) { # looks like an initial commit - # use the index primed by git-init-db + # use the index primed by git-init $ENV{GIT_INDEX_FILE} = '.git/index'; $index{$branch} = '.git/index'; } else { @@ -936,6 +969,10 @@ while () { } commit() if $branch and $state != 11; +unless ($opt_P) { + unlink($cvspsfile); +} + # The heuristic of repacking every 1024 commits can leave a # lot of unpacked data. If there is more than 1MB worth of # not-packed objects, repack once more.