From: Robert 'phaylon' Sedlacek Date: Tue, 12 Jun 2012 20:10:26 +0000 (+0000) Subject: added some better error handling to change detection X-Git-Tag: v0.000001~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FFile-Tree-Snapshot.git;a=commitdiff_plain;h=3e82afa2fb98b472b95247f71927a9c8bd6ade9c added some better error handling to change detection --- diff --git a/lib/File/Tree/Snapshot.pm b/lib/File/Tree/Snapshot.pm index ec356d4..005a7c9 100644 --- a/lib/File/Tree/Snapshot.pm +++ b/lib/File/Tree/Snapshot.pm @@ -63,7 +63,10 @@ sub create { sub _has_changes { my ($self) = @_; my $path = $self->storage_path; - my @changes = `cd $path && git diff --name-only --cached`; + my $cmd = qq{cd $path && git diff --name-only --cached}; + CORE::open my $handle, '-|', $cmd + or die "Unable to find changes in ($cmd): $!\n"; + my @changes = <$handle>; return scalar @changes; }