Git::Annex - Perl interface to git-annex repositories
version 0.008
my $annex = Git::Annex->new("/home/spwhitton/annex"); # run `git annex unused` and then `git log` to get information about # unused git annex keys my $unused_files = $self->unused(used_refspec => "+refs/heads/master", log => 1); for my $unused_file (@$unused_files) { say "unused file " . $unused_file->{key} . ":"; say ""; say " $_" for $unused_file->{log_lines}; say ""; say "you can drop it with: `git annex dropunused " . $unused_file->{number} . "`"; say ""; } # embedded Git::Wrapper instance with shortcut to access annex subcommands say for $annex->annex->find(qw(--not --in here)); $annex->annex->copy(qw(-t cloud --in here --and --lackingcopies=1));
An instance of the Git::Annex class represents a git repository in which git annex init has been run. This module provides some useful methods for working with such repositories from Perl. See https://git-annex.branchable.com/ for more information on git-annex.
git annex init
The root of the repository.
An instance of Git::Wrapper initialised in the repository.
Gives access to git-annex subcommands in the same way that Git::Annex::git gives access to git subcommands. So
$self->git->annex("contentlocation", $key);
may be written
$self->annex->contentlocation($key);
Instantiate an object representing a git-annex located in $dir.
$dir
Runs git annex unused and returns a hashref containing information on unused files.
git annex unused
The information is cached inside the .git/annex directory. This means that a user can keep running your script without repeatedly executing expensive git annex and git log commands.
.git/annex
git annex
git log
Optional arguments:
If true, run git log --stat -S on each unused file, to see what filenames the unused data had if and when it was used data in the annex.
git log --stat -S
Defaults to false, but if there is log data in the cache it will always be returned.
Corresponds to the --from option to git annex unused.
--from
Corresponds to the --used-refspec option to git annex unused.
--used-refspec
Defaults to the annex.used-refspec git config key if set, or +refs/heads/*:-refs/heads/synced/*.
annex.used-refspec
+refs/heads/*:-refs/heads/synced/*
Returns an absolute path to the content for git-annex key $key.
$key
Instantiate a Git::Annex::BatchCommand object by starting up a git-annex --batch command.
Git::Annex::BatchCommand
--batch
my $batch = $annex->batch("find", "--in=here"); say "foo/bar annexed content is present in this repo" if $batch->say("foo/bar"); # kill the batch process: undef $batch;
Sean Whitton <spwhitton@spwhitton.name>
This software is Copyright (c) 2019-2021 by Sean Whitton <spwhitton@spwhitton.name>.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007
To install Git::Annex, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Git::Annex
CPAN shell
perl -MCPAN -e shell install Git::Annex
For more information on module installation, please visit the detailed CPAN module installation guide.