X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-cvsimport-script;h=8f57396c2d815a4209e5b52cfb82465d100c4069;hb=aed022ab4ca1055e1c962b73e14dbf41380f84a9;hp=6d5a7fad38b128876903c96ce3badcc01001b185;hpb=c619ad510b39a07c76cc6a112e4a065e0b8d1b14;p=git.git diff --git a/git-cvsimport-script b/git-cvsimport-script index 6d5a7fad..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 <) { $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; @@ -683,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; @@ -723,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; @@ -732,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");