We can rely on implicit join in string interpolation on die()
iff needed.
And just creating the arrayref up front to avoid an extra
backslash seems nicer at the moment.
sub git_config_dump {
my ($file) = @_;
return {} unless -e $file;
sub git_config_dump {
my ($file) = @_;
return {} unless -e $file;
- my @cmd = (qw/git config -z -l --includes/, "--file=$file");
- my $cmd = join(' ', @cmd);
- my $fh = popen_rd(\@cmd);
+ my $cmd = [ qw(git config -z -l --includes), "--file=$file" ];
+ my $fh = popen_rd($cmd);
my $rv = config_fh_parse($fh, "\0", "\n");
my $rv = config_fh_parse($fh, "\0", "\n");
- close $fh or die "failed to close ($cmd) pipe: $?";
+ close $fh or die "failed to close (@$cmd) pipe: $?";