Skip to content

Commit a12477d

Browse files
Ben Waltongitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 640d9d0 commit a12477d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

git-cvsimport.perl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ sub munge_user_filename {
617617
$last_branch = $opt_o;
618618
$orig_branch = "";
619619
} else {
620-
open(F, "git symbolic-ref HEAD |") or
620+
open(F, "-|", qw(git symbolic-ref HEAD)) or
621621
die "Cannot run git symbolic-ref: $!\n";
622622
chomp ($last_branch = <F>);
623623
$last_branch = basename($last_branch);
@@ -631,8 +631,8 @@ sub munge_user_filename {
631631

632632
# Get the last import timestamps
633633
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";
636636
while (defined(my $entry = <H>)) {
637637
my ($ref, $author);
638638
eval($entry) || die "cannot eval refs list: $@";
@@ -730,7 +730,7 @@ (\@\@)
730730
}
731731

732732
sub write_tree () {
733-
open(my $fh, '-|', "git write-tree")
733+
open(my $fh, '-|', qw(git write-tree))
734734
or die "unable to open git write-tree: $!";
735735
chomp(my $tree = <$fh>);
736736
is_sha1($tree)

0 commit comments

Comments
 (0)