Merge early part of 'sp/reflog' branch
[gitweb.git] / git-cvsimport.perl
index 6c0f5d29380015fb4fb2c2948bb367e8d493e793..8c707f2c664ccfc9cad4fca443a5dee1d75604ba 100755 (executable)
@@ -350,7 +350,7 @@ sub _line {
                                return $res;
                        } elsif($line =~ s/^E //) {
                                # print STDERR "S: $line\n";
-                       } elsif($line =~ /^Remove-entry /i) {
+                       } elsif($line =~ /^(Remove-entry|Removed) /i) {
                                $line = $self->readline(); # filename
                                $line = $self->readline(); # OK
                                chomp $line;
@@ -677,11 +677,7 @@ ($$)
        waitpid($pid,0);
        die "Error running git-commit-tree: $?\n" if $?;
 
-       open(C,">$git_dir/refs/heads/$branch")
-               or die "Cannot open branch $branch for update: $!\n";
-       print C "$cid\n"
-               or die "Cannot write branch $branch for update: $!\n";
-       close(C)
+       system("git-update-ref refs/heads/$branch $cid") == 0
                or die "Cannot write branch $branch for update: $!\n";
 
        if($tag) {
@@ -881,6 +877,7 @@ ($$)
        }
        my $tip_at_end = `git-rev-parse --verify HEAD`;
        if ($tip_at_start ne $tip_at_end) {
+               for ($tip_at_start, $tip_at_end) { chomp; }
                print "Fetched into the current branch.\n" if $opt_v;
                system(qw(git-read-tree -u -m),
                       $tip_at_start, $tip_at_end);