X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-cvsimport-script;h=8f57396c2d815a4209e5b52cfb82465d100c4069;hb=c742b813971a415fea6e623de4d9e45286a0a976;hp=4c0333b9290a15d6222f68b6397fc456116854cd;hpb=f4b3a4c30b5ea3a5de2a2597a3c53266017d02ba;p=git.git diff --git a/git-cvsimport-script b/git-cvsimport-script index 4c0333b9..8f57396c 100755 --- a/git-cvsimport-script +++ b/git-cvsimport-script @@ -28,19 +28,19 @@ use POSIX qw(strftime dup2); $SIG{'PIPE'}="IGNORE"; $ENV{'TZ'}="UTC"; -our($opt_h,$opt_o,$opt_v,$opt_d,$opt_p,$opt_C,$opt_z); +our($opt_h,$opt_o,$opt_v,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i); sub usage() { print STDERR <_line($fh); die "No input: $fn $rev\n" unless defined $res; } + close ($fh); return ($name, $res); } @@ -674,7 +675,7 @@ while() { $state = 9; } elsif($state == 8) { $logmsg .= "$_\n"; - } elsif($state == 9 and /^\s+(\S+):(INITIAL|\d(?:\.\d+)+)->(\d(?:\.\d+)+)\s*$/) { + } elsif($state == 9 and /^\s+(\S+):(INITIAL|\d+(?:\.\d+)+)->(\d+(?:\.\d+)+)\s*$/) { # VERSION:1.96->1.96.2.1 my $init = ($2 eq "INITIAL"); my $fn = $1; @@ -682,7 +683,7 @@ while() { $fn =~ s#^/+##; my ($tmpname, $size) = $cvs->file($fn,$rev); print "".($init ? "New" : "Update")." $fn: $size bytes.\n" if $opt_v; - open my $F, '-|', "git-write-blob $tmpname" + open my $F, '-|', "git-hash-object -w $tmpname" or die "Cannot create object: $!\n"; my $sha = <$F>; chomp $sha; @@ -722,8 +723,10 @@ if($orig_branch) { print "DONE\n" if $opt_v; system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master") if $forward_master; - system('git-read-tree', '-m', '-u', 'CVS2GIT_HEAD', 'HEAD'); - die "read-tree failed: $?\n" if $?; + unless ($opt_i) { + system('git-read-tree', '-m', '-u', 'CVS2GIT_HEAD', 'HEAD'); + die "read-tree failed: $?\n" if $?; + } } else { $orig_branch = "master"; print "DONE; creating $orig_branch branch\n" if $opt_v; @@ -731,7 +734,9 @@ if($orig_branch) { unless -f "$git_dir/refs/heads/master"; unlink("$git_dir/HEAD"); symlink("refs/heads/$orig_branch","$git_dir/HEAD"); - system('git checkout'); - die "checkout failed: $?\n" if $?; + unless ($opt_i) { + system('git checkout'); + die "checkout failed: $?\n" if $?; + } } unlink("$git_dir/CVS2GIT_HEAD");