cvsimport: standarize open() calls to external git tools
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>
Ben Walton committed
Jan 19, 2010 at 14:03 UTC
a12477dbe1be24c3948dd7994874d1d1187c40c3
1 file changed
+4
-4
git-cvsimport.perl
+4
-4
@@ -617,7 +617,7 @@ unless (-d $git_dir) {
617
$last_branch = $opt_o;
618
$orig_branch = "";
619
} else {
620
- open(F, "git symbolic-ref HEAD |") or
620
+ open(F, "-|", qw(git symbolic-ref HEAD)) or
621
die "Cannot run git symbolic-ref: $!\n";
622
chomp ($last_branch = <F>);
623
$last_branch = basename($last_branch);
@@ -631,8 +631,8 @@ unless (-d $git_dir) {
631
632
# Get the last import timestamps
633
my $fmt = '($ref, $author) = (%(refname), %(author));';
634
- open(H, "git for-each-ref --perl --format='$fmt' $remote |") or
635
- die "Cannot run git for-each-ref: $!\n";
634
+ my @cmd = ('git', 'for-each-ref', '--perl', "--format=$fmt", $remote);
635
+ open(H, "-|", @cmd) or die "Cannot run git for-each-ref: $!\n";
636
while (defined(my $entry = <H>)) {
637
my ($ref, $author);
638
eval($entry) || die "cannot eval refs list: $@";
@@ -730,7 +730,7 @@ sub update_index (\@\@) {
730
}
731
732
sub write_tree () {
733
- open(my $fh, '-|', "git write-tree")
733
+ open(my $fh, '-|', qw(git write-tree))
734
or die "unable to open git write-tree: $!";
735
chomp(my $tree = <$fh>);
736
is_sha1($tree)