sub run_git_1line {
- my $xopts;
- $xopts = ref $_[0] ? shift @_ : { };
open GIT, "-|", 'git', @_ or die $!;
my $l = <GIT>;
$?=0;
- if ($xopts->{ExitStatus}) {
- if (!close GIT) {
- return ($?, undef);
- } else {
- chomp $l or die "@_ ?";
- return (0, $l);
- }
- }
close GIT or die "git @_ failed ($?)\n";
chomp $l or die "@_ ?";
return $l;