From 6e1ae015b4d6a55512be3f16f9a3eaaef343f09f Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 2 Feb 2020 00:03:07 -0700 Subject: add abs_contentlocation Signed-off-by: Sean Whitton --- lib/Git/Annex.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/Git/Annex.pm b/lib/Git/Annex.pm index c872cf5..985f982 100644 --- a/lib/Git/Annex.pm +++ b/lib/Git/Annex.pm @@ -250,6 +250,19 @@ sub _clear_unused_cache { unlink $self->_unused_cache; } +=head2 abs_contentlocation($key) + +Returns an absolute path to the content for git-annex key C<$key>. + +=cut + +sub abs_contentlocation { + my ($self, $key) = @_; + my $contentlocation; + try { ($contentlocation) = $self->git->annex("contentlocation", $key) }; + $contentlocation ? rel2abs($contentlocation, $self->toplevel) : undef; +} + sub _git_path { my ($self, @input) = @_; my ($path) = $self->git->rev_parse({ git_path => 1 }, catfile @input); -- cgit v1.2.3