Skip to content

Commit

Permalink
cvsimport: standarize open() calls to external git tools
Browse files Browse the repository at this point in the history
Standardize calls to open() where external git tools are used as
part of a pipeline.  Instead of open(X, "git foo ... |)", use
open(X, "-|", qw(git foo ...)).  All calls are made without the
use of an 'sh -c' process to split the arguments.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ben Walton authored and Junio C Hamano committed Jan 19, 2010
1 parent 640d9d0 commit a12477d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions git-cvsimport.perl
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ sub munge_user_filename {
$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);
Expand All @@ -631,8 +631,8 @@ sub munge_user_filename {

# 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: $@";
Expand Down Expand Up @@ -730,7 +730,7 @@ (\@\@)
}

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)
Expand Down

0 comments on commit a12477d

Please sign in to comment.