summaryrefslogtreecommitdiff
path: root/lib/Git/Annex.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Git/Annex.pm')
-rw-r--r--lib/Git/Annex.pm16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Git/Annex.pm b/lib/Git/Annex.pm
index ad56ca8..0877697 100644
--- a/lib/Git/Annex.pm
+++ b/lib/Git/Annex.pm
@@ -69,6 +69,7 @@ use Data::Compare;
use List::Util qw(all);
use Time::HiRes qw(stat time);
use Git::Annex::BatchCommand;
+use IPC::System::Simple qw(capturex);
use Moo;
use namespace::clean;
@@ -298,14 +299,17 @@ around BUILDARGS => sub {
die "fork() failed: $!" unless defined $pid;
if ($pid) {
wait;
- if ($?) {
- chomp($toplevel = `git -C $toplevel rev-parse --show-toplevel`);
- die "git rev-parse --show-toplevel failed" if $?;
- }
+ chomp($toplevel = capturex "git",
+ "-C", $toplevel, "rev-parse", "--show-toplevel")
+ if $?;
} else {
close STDERR;
- chomp(my $output = `git -C $toplevel rev-parse --is-inside-work-tree`);
- exit ($output and $output eq "true");
+ my $output;
+ try {
+ $output = capturex "git", "-C", $toplevel, "rev-parse",
+ "--is-inside-work-tree";
+ };
+ exit($output and $output =~ /true/);
}
return { toplevel => $toplevel };