@@ -3406,6 +3406,22 @@ sub refHashEqual
34063406 return $out ;
34073407}
34083408
3409+ # an alternative to `command` that allows input to be passed as an array
3410+ # to work around shell problems with weird characters in arguments
3411+
3412+ sub safe_pipe_capture {
3413+
3414+ my @output ;
3415+
3416+ if (my $pid = open my $child , ' -|' ) {
3417+ @output = (<$child >);
3418+ close $child or die join (' ' ,@_ )." : $! $? " ;
3419+ } else {
3420+ exec (@_ ) or die " $! $? " ; # exec() can fail the executable can't be found
3421+ }
3422+ return wantarray ? @output : join (' ' ,@output );
3423+ }
3424+
34093425
34103426package GITCVS::log ;
34113427
@@ -3882,7 +3898,7 @@ sub update
38823898 # several candidate merge bases. let's assume
38833899 # that the first one is the best one.
38843900 my $base = eval {
3885- safe_pipe_capture(' git' , ' merge-base' ,
3901+ :: safe_pipe_capture(' git' , ' merge-base' ,
38863902 $lastpicked , $parent );
38873903 };
38883904 # The two branches may not be related at all,
@@ -4749,7 +4765,7 @@ sub getMetaFromCommithash
47494765 return $retVal ;
47504766 }
47514767
4752- my ($fileHash )= safe_pipe_capture(" git" ," rev-parse" ," $revCommit :$filename " );
4768+ my ($fileHash ) = :: safe_pipe_capture(" git" ," rev-parse" ," $revCommit :$filename " );
47534769 chomp $fileHash ;
47544770 if (!($fileHash =~/ ^[0-9a-f]{40}$ / ))
47554771 {
@@ -4844,8 +4860,8 @@ sub lookupCommitRef
48444860 return $commitHash ;
48454861 }
48464862
4847- $commitHash = safe_pipe_capture(" git" ," rev-parse" ," --verify" ," --quiet" ,
4848- $self -> unescapeRefName($ref ));
4863+ $commitHash = :: safe_pipe_capture(" git" ," rev-parse" ," --verify" ," --quiet" ,
4864+ $self -> unescapeRefName($ref ));
48494865 $commitHash =~s /\s *$// ;
48504866 if (!($commitHash =~/ ^[0-9a-f]{40}$ / ))
48514867 {
@@ -4854,7 +4870,7 @@ sub lookupCommitRef
48544870
48554871 if ( defined ($commitHash ) )
48564872 {
4857- my $type = safe_pipe_capture(" git" ," cat-file" ," -t" ,$commitHash );
4873+ my $type = :: safe_pipe_capture(" git" ," cat-file" ," -t" ,$commitHash );
48584874 if ( ! ($type =~/ ^commit\s *$ / ) )
48594875 {
48604876 $commitHash =undef ;
@@ -4907,7 +4923,7 @@ sub commitmessage
49074923 return $message ;
49084924 }
49094925
4910- my @lines = safe_pipe_capture(" git" , " cat-file" , " commit" , $commithash );
4926+ my @lines = :: safe_pipe_capture(" git" , " cat-file" , " commit" , $commithash );
49114927 shift @lines while ( $lines [0] =~ / \S / );
49124928 $message = join (" " ,@lines );
49134929 $message .= " " if ( $message =~ / \n $ / );
@@ -5056,25 +5072,6 @@ sub in_array
50565072 return $retval ;
50575073}
50585074
5059- =head2 safe_pipe_capture
5060-
5061- an alternative to `command` that allows input to be passed as an array
5062- to work around shell problems with weird characters in arguments
5063-
5064- =cut
5065- sub safe_pipe_capture {
5066-
5067- my @output ;
5068-
5069- if (my $pid = open my $child , ' -|' ) {
5070- @output = (<$child >);
5071- close $child or die join (' ' ,@_ )." : $! $? " ;
5072- } else {
5073- exec (@_ ) or die " $! $? " ; # exec() can fail the executable can't be found
5074- }
5075- return wantarray ? @output : join (' ' ,@output );
5076- }
5077-
50785075=head2 mangle_dirname
50795076
50805077create a string from a directory name that is suitable to use as
0 commit comments