Code

grep: simplify assignment of ->fixed
[git.git] / git-cvsimport.perl
index adffa0c3cd486bcbe1a9e0a459aa2d1ec00d79d1..4853bf7a0d2d3cb99dee3f3fc371a48209c9efe2 100755 (executable)
@@ -609,15 +609,15 @@ $orig_git_index = $ENV{GIT_INDEX_FILE} if exists $ENV{GIT_INDEX_FILE};
 my %index; # holds filenames of one index per branch
 
 unless (-d $git_dir) {
-       system("git init");
+       system(qw(git init));
        die "Cannot init the GIT db at $git_tree: $?\n" if $?;
-       system("git read-tree");
+       system(qw(git read-tree));
        die "Cannot init an empty tree: $?\n" if $?;
 
        $last_branch = $opt_o;
        $orig_branch = "";
 } else {
-       open(F, "git symbolic-ref HEAD |") or
+       open(F, "-|", qw(git symbolic-ref HEAD)) or
                die "Cannot run git symbolic-ref: $!\n";
        chomp ($last_branch = <F>);
        $last_branch = basename($last_branch);
@@ -631,8 +631,8 @@ unless (-d $git_dir) {
 
        # Get the last import timestamps
        my $fmt = '($ref, $author) = (%(refname), %(author));';
-       open(H, "git for-each-ref --perl --format='$fmt' $remote |") or
-               die "Cannot run git for-each-ref: $!\n";
+       my @cmd = ('git', 'for-each-ref', '--perl', "--format=$fmt", $remote);
+       open(H, "-|", @cmd) or die "Cannot run git for-each-ref: $!\n";
        while (defined(my $entry = <H>)) {
                my ($ref, $author);
                eval($entry) || die "cannot eval refs list: $@";
@@ -730,7 +730,7 @@ sub update_index (\@\@) {
 }
 
 sub write_tree () {
-       open(my $fh, '-|', "git write-tree")
+       open(my $fh, '-|', qw(git write-tree))
                or die "unable to open git write-tree: $!";
        chomp(my $tree = <$fh>);
        is_sha1($tree)
@@ -993,7 +993,7 @@ while (<CVS>) {
                }
                commit();
                if (($commitcount & 1023) == 0) {
-                       system("git repack -a -d");
+                       system(qw(git repack -a -d));
                }
                $state = 1;
        } elsif ($state == 11 and /^-+$/) {
@@ -1017,7 +1017,7 @@ my $line = `git count-objects`;
 if ($line =~ /^(\d+) objects, (\d+) kilobytes$/) {
   my ($n_objects, $kb) = ($1, $2);
   1024 < $kb
-    and system("git repack -a -d");
+    and system(qw(git repack -a -d));
 }
 
 foreach my $git_index (values %index) {
@@ -1059,7 +1059,7 @@ if ($orig_branch) {
                if ($opt_r && $opt_o ne 'HEAD');
        system('git', 'update-ref', 'HEAD', "$orig_branch");
        unless ($opt_i) {
-               system('git checkout -f');
+               system(qw(git checkout -f));
                die "checkout failed: $?\n" if $?;
        }
 }